Skip to content

IBX-11939: Turned the PostgreSQL SERIAL columns into identity columns on 6.0 - #130

Draft
Steveb-p wants to merge 1 commit into
base/ibx-11939-4.6-5.0-merged-6.0from
feature/schema-migration-6.0
Draft

Steveb-p wants to merge 1 commit into
base/ibx-11939-4.6-5.0-merged-6.0from
feature/schema-migration-6.0

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Warning

This PR's base branch (base/ibx-11939-4.6-5.0-merged-6.0) is not the real 6.0 branch — it's 6.0 with the 4.6 (#128) and 5.0 (#129) feature branches merged in. This PR intentionally shows only the changes introduced on top of "4.6 and 5.0, once merged forward" — review #128 and #129 first. Once those merge for real and are merged forward into 6.0, this PR's base will be updated to point at the real 6.0 branch.

Warning

Schema drift between migrated and fresh 6.0 databases, fixed here. A 6.0 database built through Doctrine Migrations, installed fresh or upgraded from 5.0, differs from a fresh SchemaBuilderEvent install, mostly because Doctrine DBAL 4 writes some things differently from the 4.6 and 5.0 install migrations.

The PostgreSQL SERIAL → identity conversion is a migration and a commit of its own (ConvertPostgreSqlSerialColumnsToIdentityMigration), so it's easy to spot, or to drop to keep SERIAL columns, which work the same for inserts.

🎫 Issue IBX-11939

Note

Test-side companion — ibexa/test-core#57.
Moves the baseline fixture import into its own BaseFixtureHook (priority 950, between the
schema hooks and FixtureHook), switchable with a load_base_fixture option.
It matters here because under the Doctrine Migrations path the baseline repository content
arrives as core's ImportDataMigration rather than as a loaded fixture, and FixtureImporter
truncates every table a fixture touches before inserting — so a package's own fixture writing
into those tables would take the baseline's rows with it unless it implements AppendOnlyFixture.
Packages whose integration tests load their own fixtures depend on it; the rest are unaffected.

Note

Shared library — ibexa/doctrine-migrations.
Every migration in the table below extends the AbstractSqlMigration / SqlPlatform base it provides.
It is already merged on all three branches, so nothing in this effort is blocked on it:
#1 (4.6 baseline) · #3 (6.0 baseline) · #4 (enable_service_migrations fix) · #6 (DBAL 4).
The fix reached 5.0 and 6.0 via merge-ups #9 and #10 — which is why #5 was closed rather than merged.

Related PRs:

Package 4.6 5.0 6.0
ibexa/activity-log #166 #167 #168
ibexa/cart #172 #173 🔄 #174
ibexa/collaboration – #115 #116
ibexa/connector-ai – #198 #199
ibexa/connector-payum ⚠️ #39 #40 ⏭️ #41 🩹
ibexa/core #785 🩹 #787 🔄 🩹 #788 🩹
ibexa/corporate-account #369 #370 🔄 #371
ibexa/discounts – #341 🩹 #342 🩹
ibexa/discounts-codes – #50 #51
ibexa/doctrine-schema #41 #42 #43
ibexa/fieldtype-page #208 🩹 #209 🔄 🩹 #210 🩹
ibexa/form-builder #240 🩹 #241 🔄 🩹 #242 🩹
ibexa/measurement #133 #134 🔄 #135
ibexa/messenger – #22 #23
ibexa/migrations #438 #439 #440 ⏭️
ibexa/oauth2-server 🔄 #48 #49 #50
ibexa/order-management #188 #189 🔄 #190
ibexa/payment #204 #205 🔄 #206
ibexa/product-catalog #1543 #1544 🔄 #1545
ibexa/product-catalog-date-time-attribute – #53 #54
ibexa/product-catalog-symbol-attribute – #17 #18 ⏭️
ibexa/scheduler #168 #169 🔄 #170
ibexa/segmentation #186 #187 🔄 #188 🩹
ibexa/share – #190 #191 ⏭️
ibexa/shipping #154 #155 🔄 #156
ibexa/shopping-list – #66 #67
ibexa/site-context – – #121
ibexa/site-factory #172 #173 🔄 🩹 #174 🩹
ibexa/taxonomy ⚠️ #431 #432 #433 🩹
ibexa/translations-management – #174 #175
ibexa/user #128 #129 🔄 this PR
ibexa/workflow #191 🩹 #192 🔄 🩹 #193 🩹

🔄 = this branch adds an upgrade migration (renames/FK-retargets existing schema), not just a fresh baseline.
🩹 = this branch also received a backported delta migration, converted from a legacy ibexa/installer upgrade/db/*.sql script (4.6.0 or later) that the original baseline-only migration didn't cover. See IBX-11939 upgrade-scripts backport report or that package's own PR description for details.
⚠️ = fixes a different, related problem (missing SchemaBuilderEvent support for a plain Doctrine ORM entity/table) — not a Doctrine Migrations baseline/upgrade migration like the rest of this table. See that package's own PR description for details.
⏭️ = struck through and closed as unnecessary — that tier needs no changes of its own. Everything it requires arrives through the normal merge-up from the tier below; the branch is kept, so the PR can be reopened if genuinely tier-specific work turns up.

Description:

Reopened, as 6.0 turned out to need changes of its own after all. Everything else this package needs on 6.0 still arrives through the merge-up of #129, and this PR's base now has the current 6.0 and #129 merged in, so it shows only these migrations.

A 6.0 database built through Doctrine Migrations, installed fresh or upgraded from 5.0, differs from a fresh SchemaBuilderEvent install here:

  • Identity columns (ConvertPostgreSqlSerialColumnsToIdentityMigration): on PostgreSQL, Doctrine DBAL 4 creates autoincrement columns as GENERATED BY DEFAULT AS IDENTITY, where the 4.6 and 5.0 install migrations made these 2 SERIAL. A PL/pgSQL block in sql/convert-serial-columns-to-identity-postgresql.sql turns each into an identity column that carries on from its sequence's current value, and drops the old sequence.

Each migration keeps its SQL in sql/*.sql files, so it can be read or run by hand; the PHP only checks whether it's needed, and does nothing where the database already matches.

Locally, with every package's 6.0 work and the 5.0 work merged up as the merge-ups will, on MySQL 8.0, MariaDB 10.11 and PostgreSQL 16: a fresh install through migrations, a fresh SchemaBuilderEvent install migrated afterwards, and 5.0 databases from both install paths upgraded to 6.0 all give the same schema as a fresh SchemaBuilderEvent install, by Doctrine DBAL's comparison and by constraint, index and column name. The only difference left is ibexa/messenger's composite index name. The upgrades need ibexa/doctrine-migrations#23.

Related 6.0 fixes:

@Steveb-p
Steveb-p force-pushed the feature/schema-migration-6.0 branch 2 times, most recently from d81ff36 to 441302a Compare July 24, 2026 10:51
@Steveb-p
Steveb-p changed the base branch from 6.0 to base/ibx-11939-4.6-5.0-merged-6.0 July 24, 2026 10:51
@Steveb-p
Steveb-p marked this pull request as ready for review July 24, 2026 12:18
@sonarqubecloud

Copy link
Copy Markdown

@Steveb-p
Steveb-p force-pushed the base/ibx-11939-4.6-5.0-merged-6.0 branch from 7c6ad95 to 8732c82 Compare September 18, 2026 19:02
@Steveb-p
Steveb-p force-pushed the feature/schema-migration-6.0 branch from 08ce156 to bf568b8 Compare September 18, 2026 19:04
@Steveb-p Steveb-p closed this Sep 23, 2026
@Steveb-p Steveb-p reopened this Oct 6, 2026
@Steveb-p
Steveb-p force-pushed the feature/schema-migration-6.0 branch from 4e5157f to 6765e1d Compare October 6, 2026 11:50
@Steveb-p Steveb-p changed the title IBX-11939: Added Doctrine Migrations for the user-invitation schema IBX-11939: Turned the PostgreSQL SERIAL columns into identity columns on 6.0 Oct 6, 2026
@Steveb-p
Steveb-p marked this pull request as draft October 6, 2026 11:50
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

Doctrine DBAL 4 creates autoincrement columns on PostgreSQL as GENERATED BY
DEFAULT AS IDENTITY, where the 4.6 and 5.0 install migrations created SERIAL
ones. This is a migration of its own, so it can be left out to keep SERIAL.
@Steveb-p
Steveb-p force-pushed the feature/schema-migration-6.0 branch from 6765e1d to fd3e346 Compare October 6, 2026 12:27
@sonarqubecloud

sonarqubecloud Bot commented Oct 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants