Skip to content

Commit

Permalink
Merge pull request #5296 from mhsdesign/task/add-primary-keys-and-uni…
Browse files Browse the repository at this point in the history
…que-indexes-on-graph-projection-tables

BUGFIX: Add primary keys and unique indexes on graph projection tables
  • Loading branch information
dlubitz authored Oct 29, 2024
2 parents 64aca4b + 3b39d1c commit 8776839
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@ private function createWorkspaceTable(): Table
DbalSchemaFactory::columnForContentStreamId('currentContentStreamId')->setNotNull(true),
]);

$workspaceTable->addUniqueIndex(['currentContentStreamId']);

return $workspaceTable->setPrimaryKey(['name']);
}

private function createContentStreamTable(): Table
{
return self::createTable($this->tableNames->contentStream(), [
$contentStreamTable = self::createTable($this->tableNames->contentStream(), [
DbalSchemaFactory::columnForContentStreamId('id')->setNotnull(true),
(new Column('version', Type::getType(Types::INTEGER)))->setNotnull(true),
DbalSchemaFactory::columnForContentStreamId('sourceContentStreamId')->setNotnull(false),
Expand All @@ -131,6 +133,8 @@ private function createContentStreamTable(): Table
(new Column('status', Type::getType(Types::BINARY)))->setLength(20)->setNotnull(true),
(new Column('removed', Type::getType(Types::BOOLEAN)))->setDefault(false)->setNotnull(false),
]);

return $contentStreamTable->setPrimaryKey(['id']);
}

/**
Expand Down

0 comments on commit 8776839

Please sign in to comment.