Methods used for bootstrapping the schema of newly created databases.
@return Root schema
423993
public static ZooClassDef bootstrapZooPCImpl() {
		//The bootstrapped schemata have a fixed OID.
		//This is because they also need to be created every time we open a database.
		//They are required to actually read the boot-schema from the database ....
		//Actually, we don't really need to read them, but they shold be in the database
		//anyway, for consistency.
		//TODO maybe we don't need to store ZooClassDef????
		// -> and ZooPC does not need to be bootstrapped in memory????
		ZooClassDef x = new ZooClassDef(ZooPC.class.getName(), 50, 0, 50, 0);
		x.cls = ZooPC.class;
		x.className = ZooPC.class.getName();
		//x.associateFields(); //doesn't seem to be necessary
		return x;
	}
852932
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root($this->alias);

        $rootNode
            ->children()
                ->arrayNode('admin')
                    ->children()
                        ->arrayNode('form')
                            ->prototype('array')
                                ->prototype('array')
                                    ->children()
                                        ->scalarNode('form')->isRequired()->cannotBeEmpty()->end()
                                    ->end()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('wrap')
                    ->fixXmlConfig('pattern')
                    ->children()
                        ->arrayNode('patterns')
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('orm')
                    ->children()
                        ->scalarNode('entity_manager')
                            ->defaultNull()
                            ->cannotBeEmpty()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('install')
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->prototype('array')
                            ->children()
                                ->scalarNode('resource')->end()
                                ->scalarNode('target')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('override')
                    ->prototype('array')
                        ->children()
                            ->scalarNode('class')
                                ->isRequired()
                                ->cannotBeEmpty()
                            ->end()
                            ->scalarNode('override')
                                ->defaultValue(null)
                            ->end()
                            ->scalarNode('file')
                                ->isRequired()
                                ->cannotBeEmpty()
                            ->end()
                            ->enumNode('static')
                                ->defaultValue('self')
                                ->values(['self', 'static'])
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->variableNode('config')
                ->end()
            ->end();

        return $treeBuilder;
    }
208455
public function getSchema()
    {
        if ($this->_schema === null) {
            $this->_schema = $this->_initializeSchema(
                $this->getConnection()
                    ->getSchemaCollection()
                    ->describe($this->getTable())
            );
        }

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

        $schema->labelColumnName = "RoleName";

        return $schema;
    }
1161391
public function getSchema(): ?Builder
    {
        if (!$this->hasSchema()) {
            $this->setSchema($this->getDefaultSchema());
        }
        return $this->schema;
    }
810970
public function getTaxonomyXSD()
	{
		if ( $this->schemaXSD === null ) $this->schemaXSD = pathinfo( $this->schemaLocation, PATHINFO_BASENAME );
		return $this->schemaXSD;
	}
446436
public function getRootId()
    {
        if (self::$rootId !== null) {
            return self::$rootId;
        }

        // Get the root item.
        $k = $this->getKeyName();

        // Test for a unique record with parent_id = 0
        $query = $this->db->getQuery(true)
            ->select($k)
            ->from($this->db->quoteName($this->table))
            ->where('parent_id = 0');

        $result = $this->db->setQuery($query)->loadColumn();

        if (count($result) == 1) {
            return self::$rootId = $result[0];
        }

        // Test for a unique record with lft = 0
        $query->clear()
            ->select($k)
            ->from($this->db->quoteName($this->table))
            ->where('lft = 0');

        $result = $this->db->setQuery($query)->loadColumn();

        if (count($result) == 1) {
            return self::$rootId = $result[0];
        }

        throw new NestedHandleException(sprintf('%s::getRootId', get_class($this)));
    }
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;
    }
1081033
public function getSchema() {
        if ($this->_schema instanceof Schema) {
            return $this->_schema;

        // Manually defined columns
        // Allows for full schema and key/index support
        } else if ($this->_schema && is_array($this->_schema)) {
            $columns = $this->_schema;

        // Inspect database for columns
        // This approach should only be used for validating columns and types
        } else {
            $columns = $this->getDriver()->describeTable($this->getTable());
        }

        $this->setSchema(new Schema($this->getTable(), $columns));

        return $this->_schema;
    }
205165
public function getSchema()
    {
        $schema = $this->onikiri()->getTableSchema($this->getTableName(), $this->getDatabase());
        return $schema;
    }
694745
public function get_install_xml_schema() {
        global $CFG;
        require_once($CFG->libdir.'/adminlib.php');

        $schema = new xmldb_structure('export');
        $schema->setVersion($CFG->version);

        foreach ($this->get_install_xml_files() as $filename) {
            $xmldb_file = new xmldb_file($filename);
            if (!$xmldb_file->loadXMLStructure()) {
                continue;
            }
            $structure = $xmldb_file->getStructure();
            $tables = $structure->getTables();
            foreach ($tables as $table) {
                $table->setPrevious(null);
                $table->setNext(null);
                $schema->addTable($table);
            }
        }
        return $schema;
    }
1362525
protected function createSchema()
    {
        $schema = new MySqlSchema("tblApplicationVersion");
        $schema->addColumn(
            new AutoIncrement("ApplicationVersionID"),
            new Decimal("Version"),
            new Enum("VersionStatus", "NotMigrated", ["NotMigrated", "Migrated", "Failed"]),
            new MediumText("FailureMessages")
        );

        return $schema;
    }
588097
public function root()
    {
        $category = $this->createModel();

        $category = $category->whereExists(function($query)
        {
            $query->select(\DB::raw(1))
                  ->from('category_hierarchy')
                  ->whereRaw(DB::getTablePrefix().'categories.id = '.DB::getTablePrefix().'category_hierarchy.category_id')
                  ->where('category_hierarchy.category_parent_id', 0);
        });

        return $category;
    }
1080259
protected function setupRootNode()
    {
        $builder = new TreeBuilder();
        $this->rootNode = $builder->root($this->getBundleName());

        return $this;
    }
874108
public function createSchema()
    {
        $schema = new ModelSchema("tblServer");
        $schema->addColumn(
            new AutoIncrement("ServerID"),
            new String("ServerName", 50),
            new EncryptedString("Host", 80),
            new EncryptedString("Port", 25)
        );

        $schema->labelColumnName = "ServerName";

        return $schema;
    }
925676
def schema_root(self) -> "SchemaTreeNode":
        """"""
        sn = self
        while sn.parent:
            sn = sn.parent
        return sn
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);
    }