Returns the schema for this data object.

@return \Rhubarb\Stem\Schema\ModelSchema
486599
protected function createSchema()
    {
        $schema = new ModelSchema("tblAuthenticationUser");

        $schema->addColumn(
            new AutoIncrementColumn("UserID"),
            new StringColumn("Username", 30, null),
            new StringColumn("Password", 200),
            new StringColumn("Forename", 80),
            new StringColumn("Surname", 80),
            new StringColumn("Email", 150),
            new StringColumn("Token", 200),
            new DateTimeColumn("TokenExpiry"),
            new BooleanColumn("Enabled", false),
            new StringColumn("PasswordResetHash", 200),
            new DateTimeColumn("PasswordResetDate"),
            new DateTimeColumn("LastPasswordChangeDate")
        );

        $schema->labelColumnName = "FullName";

        return $schema;
    }
263424
private function getSchema(): ?SchemaInterface
    {
        if (!empty($this->schema)) {
            return $this->schema;
        }

        if (!empty($this->options['schema'])) {
            //TODO check instance of
            $this->schema = $this->options['schema'];
            return $this->schema;
        }

        if (!empty($this->options['subSchema'])) {

            //TODO this is a dirty way of receiving the service
            $receiver = null;
            if ($this->serviceManager->has($this->options['subSchema'])) {
                $receiver = $this->serviceManager->get($this->options['subSchema']);
            }

            if (empty($receiver)) {
                foreach (\array_keys($this->serviceManager->getServiceManagerConfig()->getSubManagers()) as $subManager) {
                    if ($this->serviceManager->get($subManager)->has($this->options['subSchema'])) {
                        $receiver = $this->serviceManager->get($subManager)->get($this->options['subSchema']);
                        break;
                    }
                }
            }

            if (!($receiver instanceof SubSchemaReceiverInterface)) {
                throw new \Exception($this->options['subSchema'] . " must implement " . SubSchemaReceiverInterface::class);
            }

            $this->schema = $receiver->receiveSchema($this->options['subSchemaName'], $this->builder);
            return $this->schema;
        }

        //TODO Exception
    }
167169
public function getDefaultSchema(): ?Builder
    {
        // By default, the schema facade depends upon a
        // database connection being available. Therefore,
        // we need to ensure that this is true, before
        // attempting to return the facade-root
        $manager = DB::getFacadeRoot();
        if (isset($manager) && ! is_null($manager->connection())) {
            return Schema::getFacadeRoot();
        }
        return $manager;
    }
1232057
public function loadSchemaFile(): Schema
    {
        if (!file_exists($this->schemaFile)) {
            return new Schema();
        }

        $content = file_get_contents($this->schemaFile);
        $desc = Yaml::parse($content);
        if (empty($desc)) {
            return new Schema();
        }

        $builder = new SchemaBuilder();
        return $builder->build($desc['schema']);
    }
1104598
protected function createSchema()
    {
        $schema = new ModelSchema("tblMenuItem");

        $schema->addColumn(
            new AutoIncrementColumn("MenuItemID"),
            new ForeignKeyColumn("ParentMenuItemID", 0),
            new ForeignKeyColumn('MenuID', 0),
            new StringColumn("MenuName", 50),
            new StringColumn("Url", 200),
            new StringColumn("SecurityOption", 200),
            new StringColumn("ParentMenuItemIDs", 200),
            new StringColumn("CssClassName", 40),
            new IntegerColumn("Position", 0)
        );

        return $schema;
    }
956042
public function getDataSchema()
    {
        $schema = [
            'description' => $this->Description,
            'link' => 'https://addons.silverstripe.org/add-ons/' . $this->Name,
            'linkTitle' => _t(
                __CLASS__ . '.ADDONS_LINK_TITLE',
                'View {package} on addons.silverstripe.org',
                ['package' => $this->Title]
            ),
            'rating'=> (int) $this->Rating
        ];

        $this->extend('updateDataSchema', $schema);

        return $schema;
    }
113826
protected function createSchema()
    {
        $schema = new ModelSchema("tblApplicationSetting");
        $schema->addColumn(
            new AutoIncrementColumn("ApplicationSettingID"),
            new StringColumn("SettingName", 60),
            new BinaryDataColumn("SettingValue")
        );

        $schema->addIndex(new Index("SettingName", MySqlIndex::UNIQUE, ["SettingName"]));

        return $schema;
    }
67041
public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => "{$this->parent_post_type}-revision",
			'type'       => 'object',
			/*
			 * Base properties for every Revision
			 */
			'properties' => array(
				'author'          => array(
					'description' => __( 'The id for the author of the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'date'            => array(
					'description' => __( 'The date the object was published.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'date_gmt'        => array(
					'description' => __( 'The date the object was published, as GMT.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'guid'            => array(
					'description' => __( 'GUID for the object, as it exists in the database.' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
				),
				'id'              => array(
					'description' => __( 'Unique identifier for the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'modified'        => array(
					'description' => __( 'The date the object was last modified.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'modified_gmt'    => array(
					'description' => __( 'The date the object was last modified, as GMT.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'parent'          => array(
					'description' => __( 'The id for the parent of the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
					),
				'slug'            => array(
					'description' => __( 'An alphanumeric identifier for the object unique to its type.' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
			),
		);

		$parent_schema = $this->parent_controller->get_item_schema();

		if ( ! empty( $parent_schema['properties']['title'] ) ) {
			$schema['properties']['title'] = $parent_schema['properties']['title'];
		}
		if ( ! empty( $parent_schema['properties']['content'] ) ) {
			$schema['properties']['content'] = $parent_schema['properties']['content'];
		}
		if ( ! empty( $parent_schema['properties']['excerpt'] ) ) {
			$schema['properties']['excerpt'] = $parent_schema['properties']['excerpt'];
		}
		if ( ! empty( $parent_schema['properties']['guid'] ) ) {
			$schema['properties']['guid'] = $parent_schema['properties']['guid'];
		}

		return $this->add_additional_fields_schema( $schema );
	}
1107375
protected function _getSchema( $name )
	{
		if( !isset( $this->_schemas[$name] ) ) {
			return $this->_schema;
		}

		return $this->_schemas[$name];
	}
239677
protected function createSchema()
    {
        $schema = new ModelSchema("tblAuthenticationPermissionAssignment");
        $schema->addColumn(
            new AutoIncrementColumn("PermissionAssignmentID"),
            new ForeignKeyColumn("UserID"),
            new ForeignKeyColumn("RoleID"),
            new ForeignKeyColumn("PermissionID"),
            new MySqlEnumColumn("Access", self::ACCESS_DENIED, [self::ACCESS_ALLOWED, self::ACCESS_DENIED])
        );

        return $schema;
    }
913317
public function getTable()
	{
		$schema_prefix = '';
		$schema = $this->getSchema();
		if (isset($schema) && $schema != '') $schema_prefix = $schema . '.';
		
		if (isset($this->table)) 	$table = $this->table;
		else 						$table = str_replace('\\', '', snake_case(class_basename($this)));
		
		if (stripos($table, '.') !== false)
			return $table;
		else
			return $schema_prefix . $table;
	}
238390
public function getTable(): TableStructure
    {
        if ($this->_table === null) {
            $indexes = $this->getTableIndexes();

            $this->_table = new TableStructure([
                'name' => $this->tableName,
                'schema' => get_class($this->db->schema),
                'generalSchema' => $this->generalSchema,
                'usePrefix' => $this->useTablePrefix,
                'dbPrefix' => $this->db->tablePrefix,
                'primaryKey' => $this->getTablePrimaryKey(),
                'foreignKeys' => $this->getTableForeignKeys(),
                'indexes' => $indexes,
                'tableOptionsInit' => $this->tableOptionsInit,
                'tableOptions' => $this->tableOptions,
            ]);

            $this->_table->columns = $this->getTableColumns($indexes, $this->_table->schema);
        }

        return $this->_table;
    }
1354440
public function getTypes()
    {
        $schema = StaticSchema::inst();
        $tree = array_merge(
            [$this->rootClass],
            $schema->getDescendants($this->rootClass)
        );

        return array_map(function ($class) use ($tree, $schema) {
            return $schema->typeNameForDataObject($class);
        }, $tree);
    }
272177
public function getSchemaManager(){
        if($this->schemamanger == null){
            $this->schemamanger = new common_persistence_sql_pdo_mysql_SchemaManager($this);
        }
        return $this->schemamanger;
    }
1067814
final protected function getDataFromScheme()
    {
        if (empty($this->scheme) || empty($this->scheme['fields'])) {
            Throw new ModelException('There is no scheme/fields in scheme in this model');
        }

        $data = [];

        foreach ($this->scheme['fields'] as $key => $field) {
            $data[$key] = !empty($field['default']) ? $field['default'] : '';
        }

        return $data;
    }
1304450
public function getSchema()
    {
        $backup = array();
        $tables = $this->getTables();
        foreach ($tables as $table) {
            $backup[] = $this->getBackup();
        }
        
        return implode("\n\n", $backup);
    }
785600
public function createSchema()
    {
        $namespaces = [];

        if ($this->_platform->supportsSchemas()) {
            $namespaces = $this->listNamespaceNames();
        }

        $sequences = [];

        if ($this->_platform->supportsSequences()) {
            $sequences = $this->listSequences();
        }

        $tables = $this->listTables();

        return new Schema($tables, $sequences, $this->createSchemaConfig(), $namespaces);
    }