Creates the configuration for this schema.

@return SchemaConfig
481563
public function createSchemaConfig()
    {
        $schemaConfig = new SchemaConfig();
        $schemaConfig->setMaxIdentifierLength($this->_platform->getMaxIdentifierLength());

        $searchPaths = $this->getSchemaSearchPaths();
        if (isset($searchPaths[0])) {
            $schemaConfig->setName($searchPaths[0]);
        }

        $params = $this->_conn->getParams();
        if (! isset($params['defaultTableOptions'])) {
            $params['defaultTableOptions'] = [];
        }
        if (! isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) {
            $params['defaultTableOptions']['charset'] = $params['charset'];
        }
        $schemaConfig->setDefaultTableOptions($params['defaultTableOptions']);

        return $schemaConfig;
    }
121888
private function setup()
    {
        $manager = $this->getConnection()->getSchemaManager();
        if ($this->tablesExist === true || $manager->tablesExist([$this->options['db_table']]) === true) {
            $this->tablesExist = true;

            return;
        }

        $schema = new Schema();
        $table = $schema->createTable($this->options['db_table']);

        $table->addColumn($this->options['db_column_feature'], 'string', ['length' => 255]);
        $table->addColumn($this->options['db_column_state'], 'boolean');

        $table->setPrimaryKey([$this->options['db_column_feature']]);

        $platform = $this->getConnection()->getDatabasePlatform();
        $queries = $schema->toSql($platform);

        foreach ($queries as $query) {
            $this->getConnection()->executeQuery($query);
        }

        $this->tablesExist = true;
    }
25067
protected function getSchemaForEntity(): Schema
    {
        if ($this->entityClass instanceof Schema) {
            return $this->entityClass;
        }

        $model = new $this->entityClass();

        if ($model instanceof ActiveRecord) {
            return $model->getSchema();
        }

        return new DynamicSchema();
    }
579377
public function create()
    {
        //queries to run
        $queries = [];

        //translate model data to sql data
        if (is_null($this->schema)) {
            throw Exception::forNoSchema();
        }

        $data = $this->schema->toSql();

        //determine the create schema
        $query = $this
            ->resource
            ->getCreateQuery($data['name'])
            ->addPrimaryKey($data['primary'])
            ->addField($data['primary'], [
                'type' => 'int(10)',
                'null' => false,
                'attribute' => 'UNSIGNED',
                'auto_increment' => true,
            ]);

        foreach ($data['columns'] as $name => $column) {
            $attributes = ['type' => $column['type']];

            if (isset($column['length'])) {
                $attributes['type'] .= '(' . $column['length'] . ')';
            }

            if (isset($column['default']) && strlen($column['default'])) {
                $attributes['default'] = $column['default'];
            } else if (!isset($column['required']) || !$column['required']) {
                $attributes['null'] = true;
            }

            if (isset($column['required']) && $column['required']) {
                $attributes['null'] = false;
            }

            if (isset($column['attribute']) && $column['attribute']) {
                $attributes['attribute'] = $column['attribute'];
            }

            $query->addField($name, $attributes);

            if (isset($column['index']) && $column['index']) {
                $query->addKey($name, [$name]);
            }

            if (isset($column['unique']) && $column['unique']) {
                $query->addUniqueKey($name, [$name]);
            }

            if (isset($column['primary']) && $column['primary']) {
                $query->addPrimaryKey($name);
            }
        }

        $queries[] = 'DROP TABLE IF EXISTS `' . $data['name'] . '`;';
        $queries[] = (string) $query;

        //determine the relation schema
        foreach ($data['relations'] as $table => $relation) {
            $query = $this->resource->getCreateQuery($table);

            $query->addPrimaryKey($relation['primary1']);
            $query->addField($relation['primary1'], [
                'type' => 'int(10)',
                'null' => false,
                'attribute' => 'UNSIGNED'
            ]);

            $query->addPrimaryKey($relation['primary2']);
            $query->addField($relation['primary2'], [
                'type' => 'int(10)',
                'null' => false,
                'attribute' => 'UNSIGNED'
            ]);

            $queries[] = 'DROP TABLE IF EXISTS `'. $table . '`;';
            $queries[] = (string) $query;
        }

        //execute queries
        $results = [];
        foreach ($queries as $query) {
            $results[] = [
                'query' => $query,
                'results' => $this->resource->query($query)
            ];
        }

        return $results;
    }
1174172
public function createRoot()
    {
        $instance = new CachedConfigCollection();

        // Override nested config to use delta collection
        $instance->setNestFactory(function ($collection) {
            return DeltaConfigCollection::createFromCollection($collection, Config::NO_DELTAS);
        });

        // Create config cache
        if ($this->cacheFactory) {
            $cache = $this->cacheFactory->create(CacheInterface::class . '.configcache', [
                'namespace' => 'configcache'
            ]);
            $instance->setCache($cache);
        }

        // Set collection creator
        $instance->setCollectionCreator(function () {
            return $this->createCore();
        });

        return $instance;
    }
266577
public function getConfigTreeBuilder()
	{
		$treeBuilder = new TreeBuilder();

		$treeBuilder->root('framework')
				->children()
					->append($this->getLocalesDefinition())
					->append($this->getDoctrineDefinition())
					->append($this->getAuditDefinition())
					->append($this->getSessionDefinition())
					->append($this->getMailerDefinition())
					->append($this->getServicesDefinition())
				->end();

		return $treeBuilder;
	}
619568
public function build()
    {
        $this->createEntityClassParameter();

        $this->createConfigurationDefinition();

        $this->createMetadataDefinition();
        $this->createManagerDefinition();
        $this->createRepositoryDefinition();
        $this->createOperatorDefinition();

        // TODO search repository service

        $this->createControllerDefinition();

        $this->createFormDefinition();
        $this->createTableDefinition();

        $this->configureTranslations();

        return $this;
    }
288869
public function createConfigForm() {
        $clz = static::class;
        if (isset(self::$forms[ $clz ])) {
            $form = self::$forms[ $clz ];
            $form->inflateByData(['dsCfg' => $this->option]);

            return $form;
        }

        return null;
    }
1364356
protected function createSchema()
    {
        $schema = new ModelSchema("tblAuthenticationRole");
        $schema->addColumn(
            new AutoIncrementColumn("RoleID"),
            new StringColumn("RoleName", 40)
        );

        $schema->labelColumnName = "RoleName";

        return $schema;
    }
889913
public function create() {
        $data = Values::of(array());

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new ConfigurationInstance($this->version, $payload);
    }
701581
private function createConfigurationDriver()
    {
        $reflection = new \ReflectionClass($this->driverClass());

        /** @var ConfigurationInterface $config */
        $config = $reflection->hasMethod('__construct')
            ? $reflection->newInstanceArgs([$this->file])
            : $reflection->newInstance();
        return $config;
    }
1055286
public function create($schema, $ifNotExists = true, $options = [])
    {
        if ($ifNotExists && $this->db->getDatabase(null, true)->tableExists($this->getName())) {
            return $this;
        }

        $defaultOptions = [
            'auto_increment' => 1
        ];

        $options = array_merge($defaultOptions, $options);
        $schema = $this->callSchema($schema);
        $columns = [];
        $comments = [];
        $primary = [];

        foreach ($schema->getColumns() as $column) {
            $column = $this->prepareColumn($column);

            $columns[$column->getName()] = SqlsrvGrammar::build(
                $column->getType() . $column->getLength(),
                $column->getAllowNull() ? null : 'NOT NULL',
                $column->getAutoIncrement() ? 'identity' : null,
                $column->getDefault() ? 'DEFAULT ' . $this->db->quote($column->getDefault()) : null
            );

            // Comment
            if ($column->getComment()) {
                $comments[$column->getName()] = $column->getComment();
            }

            // Primary
            if ($column->isPrimary()) {
                $primary[] = $column->getName();
            }
        }

        $keys = [];
        $keyComments = [];

        foreach ($schema->getIndexes() as $index) {
            if ($index->getType() === Key::TYPE_PRIMARY) {
                $primary = array_merge($primary, $index->getColumns());
            } else {
                $keys[$index->getName()] = [
                    'type' => strtoupper($index->getType()),
                    'name' => $index->getName(),
                    'columns' => $index->getColumns(),
                ];

                if ($index->getComment()) {
                    $keyComments[$index->getName()] = $index->getComment();
                }
            }
        }

        $options['comments'] = $comments;
        $options['key_comments'] = $keyComments;

        $query = SqlsrvGrammar::createTable(
            $this->getName(),
            $columns,
            $primary,
            $keys,
            false
        );

        $this->db->execute($query);
        $query = '';

        $comments = $options['comments'] ?? [];

        // Comments
        foreach ($comments as $name => $comment) {
            $query .= ";\n" . SqlsrvGrammar::comment(
                'COLUMN',
                $this->db->replacePrefix($this->getName()),
                $name,
                $comment
            );
        }

        if ($query) {
            $this->db->execute($query);
        }

        return $this->reset();
    }
1368397
protected function createSchemas(array $configuration)
    {
        $processor = new Processor();
        $processedConfiguration = $processor->processConfiguration(
            new SchemaConfiguration(),
            $configuration
        );

        $schemas = array();
        foreach ($processedConfiguration as $schemaName => $schemaConfig) {
            $schema = new Schema($schemaName, $schemaConfig['title']);
            foreach ($schemaConfig['groups'] as $groupName => $groupConfig) {
                $group = new Group($groupName, $groupConfig['title']);
                foreach ($groupConfig['characteristics'] as $characteristicName => $characteristicConfig) {
                    $fullName = implode(':', array($schemaName, $groupName, $characteristicName));

                    $this->validateDefinitionConfig($fullName, $characteristicConfig);

                    $definition = new Definition();
                    $definition
                        ->setName($characteristicName)
                        ->setFullName($fullName)
                        ->setType($characteristicConfig['type'])
                        ->setTitle($characteristicConfig['title'])
                        ->setShared($characteristicConfig['shared'])
                        ->setVirtual($characteristicConfig['virtual'])
                        ->setPropertyPaths($characteristicConfig['property_paths'])
                        ->setFormat($characteristicConfig['format'])
                        ->setDisplayGroups($characteristicConfig['display_groups'])
                    ;
                    $group->addDefinition($definition);
                }
                $schema->addGroup($group);
            }
            $schemas[] = $schema;
        }

        return $schemas;
    }
148118
public function create()
    {
        $count = \count($this->options);

        if ($count === 1) {
            $config = \array_values($this->options)[0];
        } else {
            $index  = \random_int(0, $count - 1);
            $config = \array_values($this->options)[$index];
        }

        $db = new MySQL();
        $db->connect($config);

        return $db;
    }
470888
public static function getSchema()
    {
        $attribute = 'schema';

        if (!static::hasClassAttribute($attribute)) {
            $fields = static::getSchemaFieldsValues();
            $parser = static::getDatabase()->getParser();
            $schema = [];

            if ($fields && count($fields) > 0) {
                foreach ($fields as $name => $value) {
                    $schema[$name] = $value;
                }
            }

            $parser->parseTable($schema, $errors, static::getNamespace());

            if ($errors) {
                static::error('class', $errors[0]);
            }

            static::setClassAttribute($attribute, $schema);
        }

        return static::getClassAttribute($attribute);
    }
1317602
public function create()
    {
        $loaders = array();

        if (count($this->xmlMappings) > 1) {
            $loaders[] = new XmlFilesLoader($this->xmlMappings, $this->constraintNamespaces);
        } elseif (1 === count($this->xmlMappings)) {
            $loaders[] = new XmlFileLoader($this->xmlMappings[0], $this->constraintNamespaces);
        }

        if (count($this->yamlMappings) > 1) {
            $loaders[] = new YamlFilesLoader($this->yamlMappings, $this->constraintNamespaces);
        } elseif (1 === count($this->yamlMappings)) {
            $loaders[] = new YamlFileLoader($this->yamlMappings[0], $this->constraintNamespaces);
        }

        foreach ($this->methodMappings as $methodName) {
            $loaders[] = new StaticMethodLoader($methodName);
        }

        if ($this->annotationReader) {
            $loaders[] = new AnnotationLoader($this->annotationReader);
        }

        $loader = null;

        if (count($loaders) > 1) {
            $loader = new LoaderChain($loaders);
        } elseif (1 === count($loaders)) {
            $loader = $loaders[0];
        }

        return new LazyLoadingMetadataFactory($loader, $this->metadataCache);
    }
115508
public static function schema(){
        $classname = get_called_class();
        if(!array_key_exists($classname, self::$schemas)){
            $schema = new SchemaBuilder(static::table());
            static::define($schema);
            self::$schemas[$classname] = $schema;
        }
        return self::$schemas[$classname];
    }