Skip to content

Commit

Permalink
TASK: Remove removed state from ContentStream model and database
Browse files Browse the repository at this point in the history
Followup to

neos/neos-development-collection@f542fc3

By diffing `findAllContentStreamEventNames` with the `$transitiveUsedStreams` we can remove the `removed` flag from content streams, which would just introduce to much complexity.
  • Loading branch information
mhsdesign committed Oct 17, 2024
1 parent 0275b01 commit 78d8d29
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/ContentRepositoryReadModelAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function findContentStreamById(ContentStreamId $contentStreamId): ?Conten
{
$contentStreamByIdStatement = <<<SQL
SELECT
id, sourceContentStreamId, status, version, removed
id, sourceContentStreamId, status, version
FROM
{$this->tableNames->contentStream()}
WHERE
Expand All @@ -119,7 +119,7 @@ public function findContentStreams(): ContentStreams
{
$contentStreamsStatement = <<<SQL
SELECT
id, sourceContentStreamId, status, version, removed
id, sourceContentStreamId, status, version
FROM
{$this->tableNames->contentStream()}
SQL;
Expand Down Expand Up @@ -153,8 +153,7 @@ private static function contentStreamFromDatabaseRow(array $row): ContentStream
ContentStreamId::fromString($row['id']),
isset($row['sourceContentStreamId']) ? ContentStreamId::fromString($row['sourceContentStreamId']) : null,
ContentStreamStatus::from($row['status']),
Version::fromInteger((int)$row['version']),
(bool)$row['removed']
Version::fromInteger((int)$row['version'])
);
}
}
1 change: 0 additions & 1 deletion src/DoctrineDbalContentGraphSchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ private function createContentStreamTable(): Table
DbalSchemaFactory::columnForContentStreamId('sourceContentStreamId')->setNotnull(false),
// Should become a DB ENUM (unclear how to configure with DBAL) or int (latter needs adaption to code)
(new Column('status', Type::getType(Types::BINARY)))->setLength(20)->setNotnull(true),
(new Column('removed', Type::getType(Types::BOOLEAN)))->setDefault(false)->setNotnull(false)
]);
}

Expand Down
4 changes: 1 addition & 3 deletions src/Domain/Projection/Feature/ContentStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ private function updateContentStreamStatus(ContentStreamId $contentStreamId, Con

private function removeContentStream(ContentStreamId $contentStreamId): void
{
$this->dbal->update($this->tableNames->contentStream(), [
'removed' => true,
], [
$this->dbal->delete($this->tableNames->contentStream(), [
'id' => $contentStreamId->value
]);
}
Expand Down

0 comments on commit 78d8d29

Please sign in to comment.