From 897be3490d8da41a19f00d54d03ef3ff7a45fae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 7 Jul 2026 10:43:49 +0200 Subject: [PATCH 1/5] IBX-12029: Adjusted index of content id and version to be unique --- src/bundle/Core/Resources/config/storage/legacy/schema.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml index 68353ee052..7791494fd7 100644 --- a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml +++ b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml @@ -315,9 +315,10 @@ tables: ibexa_content_version: indexes: ibexa_content_version_status: { fields: [status] } - ibexa_content_version_idx_ver: { fields: [contentobject_id, version] } ibexa_content_version_idx_status: { fields: [contentobject_id, status] } ibexa_content_version_creator_id: { fields: [creator_id] } + uniqueConstraints: + ibexa_content_version_idx_ver: { fields: [contentobject_id, version] } id: id: { type: integer, nullable: false, options: { autoincrement: true } } fields: From f2d2336e55454ff0d05dce2c30cb67113b243722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Mon, 13 Jul 2026 15:22:32 +0200 Subject: [PATCH 2/5] IBX-12078: Made contentobject_id column non-nullable in schema --- src/bundle/Core/Resources/config/storage/legacy/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml index 7791494fd7..5ca5615007 100644 --- a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml +++ b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml @@ -322,7 +322,7 @@ tables: id: id: { type: integer, nullable: false, options: { autoincrement: true } } fields: - contentobject_id: { type: integer, nullable: true } + contentobject_id: { type: integer, nullable: false } created: { type: integer, nullable: false, options: { default: '0' } } creator_id: { type: integer, nullable: false, options: { default: '0' } } initial_language_id: { type: bigint, nullable: false, options: { default: '0' } } From 67e653a9e0e7c4104b70e93c09bf52324a09227c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 14 Jul 2026 08:54:49 +0200 Subject: [PATCH 3/5] IBX-12078: Renamed unique key name --- src/bundle/Core/Resources/config/storage/legacy/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml index 5ca5615007..ced31580a1 100644 --- a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml +++ b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml @@ -318,7 +318,7 @@ tables: ibexa_content_version_idx_status: { fields: [contentobject_id, status] } ibexa_content_version_creator_id: { fields: [creator_id] } uniqueConstraints: - ibexa_content_version_idx_ver: { fields: [contentobject_id, version] } + uq_ibexa_content_version_coid_version: { fields: [contentobject_id, version] } id: id: { type: integer, nullable: false, options: { autoincrement: true } } fields: From 06119482d6c0156612090048182556ed5d969594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Tue, 14 Jul 2026 15:59:59 +0200 Subject: [PATCH 4/5] IBX-12078: Added integration test asserting insertVersion throws on duplicate content id and version number --- .../Content/Gateway/DoctrineDatabaseTest.php | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/integration/Core/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php diff --git a/tests/integration/Core/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php b/tests/integration/Core/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php new file mode 100644 index 0000000000..01628fdd26 --- /dev/null +++ b/tests/integration/Core/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php @@ -0,0 +1,75 @@ +get(DoctrineDatabase::class . '.inner'); + self::assertInstanceOf(DoctrineDatabase::class, $gateway); + + $this->gateway = $gateway; + } + + public function testInsertVersionThrowsOnDuplicateContentIdAndVersionNo(): void + { + $versionInfo = $this->getVersionInfoFixture(); + + self::assertGreaterThan(0, $this->gateway->insertVersion($versionInfo, [])); + + $this->expectException(UniqueConstraintViolationException::class); + $this->gateway->insertVersion($versionInfo, []); + } + + private function getVersionInfoFixture(): VersionInfo + { + $versionInfo = new VersionInfo(); + + $versionInfo->id = null; + $versionInfo->versionNo = self::VERSION_NO; + $versionInfo->creatorId = 14; + $versionInfo->status = VersionInfo::STATUS_DRAFT; + $versionInfo->creationDate = 1312278322; + $versionInfo->modificationDate = 1312278323; + $versionInfo->initialLanguageCode = 'eng-GB'; + $versionInfo->contentInfo = new ContentInfo( + [ + 'id' => self::CONTENT_ID, + 'alwaysAvailable' => true, + ] + ); + + return $versionInfo; + } +} From 51742928d63345417e526ca01251e2e04c8a3e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Nowak?= Date: Wed, 15 Jul 2026 10:07:56 +0200 Subject: [PATCH 5/5] IBX-12078: Adjusted unique key name --- src/bundle/Core/Resources/config/storage/legacy/schema.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml index ced31580a1..72615c3a5d 100644 --- a/src/bundle/Core/Resources/config/storage/legacy/schema.yaml +++ b/src/bundle/Core/Resources/config/storage/legacy/schema.yaml @@ -318,7 +318,7 @@ tables: ibexa_content_version_idx_status: { fields: [contentobject_id, status] } ibexa_content_version_creator_id: { fields: [creator_id] } uniqueConstraints: - uq_ibexa_content_version_coid_version: { fields: [contentobject_id, version] } + ibexa_content_version_coid_version_unique: { fields: [contentobject_id, version] } id: id: { type: integer, nullable: false, options: { autoincrement: true } } fields: