addColumn(NewSqlStorage::REVISION_RESOURCE, 'string', ['notnull' => false, 'length' => 255]); $revisionTable->addColumn(NewSqlStorage::REVISION_VERSION, 'string', ['notnull' => false, 'length' => 50]); $revisionTable->addColumn(NewSqlStorage::REVISION_USER, 'string', ['notnull' => true, 'length' => 255]); $revisionTable->addColumn(NewSqlStorage::REVISION_CREATED, 'string', ['notnull' => true]); $revisionTable->addColumn(NewSqlStorage::REVISION_MESSAGE, 'string', ['notnull' => true, 'length' => 4000]); $revisionTable->setPrimaryKey([NewSqlStorage::REVISION_RESOURCE, NewSqlStorage::REVISION_VERSION]); } public function createRevisionDataTable(Table $dataTable, Table $revisionTable) { $dataTable->addColumn(NewSqlStorage::DATA_RESOURCE_ID, 'string', ['notnull' => false, 'length' => 50]); $dataTable->addColumn(NewSqlStorage::DATA_RESOURCE, 'string', ['notnull' => false, 'length' => 255]); $dataTable->addColumn(NewSqlStorage::DATA_VERSION, 'string', ['notnull' => false, 'length' => 50]); $dataTable->addColumn(NewSqlStorage::DATA_SUBJECT, 'string', ['notnull' => true, 'length' => 255]); $dataTable->addColumn(NewSqlStorage::DATA_PREDICATE, 'string', ['length' => 255]); $dataTable->addColumn(NewSqlStorage::DATA_OBJECT, 'text', ['default' => null, 'notnull' => false]); $dataTable->addColumn(NewSqlStorage::DATA_LANGUAGE, 'string', ['length' => 50]); $dataTable->setPrimaryKey([NewSqlStorage::DATA_RESOURCE_ID]); $dataTable->addForeignKeyConstraint( $revisionTable, [NewSqlStorage::REVISION_RESOURCE, NewSqlStorage::REVISION_VERSION], [NewSqlStorage::REVISION_RESOURCE, NewSqlStorage::REVISION_VERSION] ); } /** * @inheritDoc */ public function getSchema(Schema $schema) { /** @var Table $revisionTable */ $revisionTable = $schema->createtable(NewSqlStorage::REVISION_TABLE_NAME); $this->createRevisionTable($revisionTable); /** @var Table $dataTable */ $dataTable = $schema->createtable(NewSqlStorage::DATA_TABLE_NAME); $this->createRevisionDataTable($dataTable, $revisionTable); return $schema; } }