Repository navigation
IBX-11939: [Doctrine Migrations] Added Doctrine Migrations-based schema and data install path (inlined SQL) - #785
Merged
Conversation
Closed
5 of 6 tasks
Contributor
Author
|
Companion PR in |
ibexa-workflow-automation-1
Bot
requested review from
ViniTou,
alongosz,
barw4,
bnowak,
ciastektk,
konradoboza,
mikadamczyk,
tbialcz and
wiewiurdp
and removed request for
a team
July 20, 2026 07:34
This was referenced Jul 20, 2026
Merged
Closed
Closed
bnowak
reviewed
Jul 23, 2026
Steveb-p
force-pushed
the
doctrine-migrations-installer-inline-sql
branch
from
July 24, 2026 11:12
7114546 to
4e9c810
Compare
Steveb-p
added a commit
that referenced
this pull request
Jul 24, 2026
Replaces the AbstractVersion + YAML manifest + one-SQL-statement-per-file mechanism with InstallSchemaMigration/ImportDataMigration implemented as plain Doctrine\Migrations\AbstractMigration subclasses with all SQL inlined via addSql(), still implementing IbexaMigrationInterface and tagged with IbexaMigrationTag so TaggedMigrationsRunner/IbexaOnlyDependencyFactory work unchanged. Long/multiline statements use PHP NOWDOC for readability, with CREATE TABLE bodies pretty-printed one column per line. Same conversion as #785 for the 4.6 line, adapted for this branch's ibexa_*-renamed schema and dbal 3.x platform class names (AbstractMySQLPlatform/PostgreSQLPlatform instead of MySqlPlatform/ PostgreSqlPlatform).
Steveb-p
added a commit
that referenced
this pull request
Jul 24, 2026
Replaces the AbstractVersion + YAML manifest + one-SQL-statement-per-file mechanism with InstallSchemaMigration/ImportDataMigration implemented as plain Doctrine\Migrations\AbstractMigration subclasses with all SQL inlined via addSql(), still implementing IbexaMigrationInterface and tagged with IbexaMigrationTag so TaggedMigrationsRunner/IbexaOnlyDependencyFactory work unchanged. Long/multiline statements use PHP NOWDOC for readability, with CREATE TABLE bodies pretty-printed one column per line. Same conversion as #785 for the 4.6 line, adapted for this branch's ibexa_*-renamed schema and dbal 3.x platform class names (AbstractMySQLPlatform/PostgreSQLPlatform instead of MySqlPlatform/ PostgreSqlPlatform).
Steveb-p
added a commit
that referenced
this pull request
Sep 29, 2026
…line-sql' into base/ibx-11939-4.6-merged-5.0 #785 was rebased onto 4.6 after #852 landed there. Its tree is identical to the pre-rebase head f75405c this base already contains, so this merge only records the rebased history and keeps the base's own tree (-s ours). A regular merge would have gone back to the old merge base and re-applied the lines of #785 that earlier merges here resolved the 5.0 way.
Each CREATE TABLE now lists one column, index or constraint per line, and ALTER TABLE and CREATE INDEX statements longer than 120 characters are wrapped. Only whitespace changes, apart from the comma moving in front of SQLite's --(DC2Type:...) comments, which keeps each comment with its column.
ibexa/doctrine-migrations#19 makes MariaDB a platform of its own, so each migration now lists SqlPlatform::MARIADB and runs its MySQL SQL there too.
… does on MariaDB On MariaDB, DBAL creates a JSON column as LONGTEXT with a (DC2Type:json) comment, which is what the legacy SchemaBuilderEvent path gets too. MariaDB turns MySQL's native JSON into LONGTEXT with utf8mb4_bin and a json_valid() check instead, which DBAL 2.13 then reads back as TEXT. Those tables now come from install-schema-json-tables.mariadb.sql on MariaDB and install-schema-json-tables.mysql.sql on MySQL, ahead of the rest of install-schema-mysql.sql.
Steveb-p
force-pushed
the
doctrine-migrations-installer-inline-sql
branch
from
October 2, 2026 11:28
a85ac43 to
c351f4a
Compare
It replaces installer's upgrade/db/ibexa-4.6.20-to-4.6.21.sql, so 4.6.21 is the release it is for. The target version only orders Ibexa migrations: it now runs after the 4.6.0 baselines instead of right after core's own, which is fine since it only needs core's tables.
|
tomaszszopinski
approved these changes
Oct 5, 2026
This was referenced Oct 5, 2026
Steveb-p
added a commit
to ibexa/user
that referenced
this pull request
Oct 5, 2026
…ches Points CI at ibexa/test-core#68 (the test case), ibexa/core#785 with ibexa/installer#213 (the Doctrine Migrations path). Must be removed before merging.
Steveb-p
added a commit
that referenced
this pull request
Oct 5, 2026
…Command #785 replaced InstallerTagPass with a !tagged_locator for the command's $installers argument, and both of those reached this branch through the base - but InstallPlatformCommand kept 5.0's array-typed constructor, so ibexa:install failed with a TypeError before doing anything. Ported the matching change from #785: ServiceLocator in, has()/get() for the lookup, and getProvidedServices() for listing the available types.
vidarl
reviewed
Oct 6, 2026
This was referenced Oct 8, 2026
This was referenced Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




v4.6Note
Test-side companion —
ibexa/test-core#57.Moves the baseline fixture import into its own
BaseFixtureHook(priority 950, between theschema hooks and
FixtureHook), switchable with aload_base_fixtureoption.It matters here because under the Doctrine Migrations path the baseline repository content
arrives as core's
ImportDataMigrationrather than as a loaded fixture, andFixtureImportertruncates 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/SqlPlatformbase it provides.Merged on all three branches:
#1 (4.6 baseline) · #3 (6.0 baseline) · #4 (
enable_service_migrationsfix) · #6 (DBAL 4).The fix reached 5.0 and 6.0 via merge-ups #9 and #10 — which is why
#5was closed rather than merged.Also merged on 4.6: #13 (Ibexa SQL migrations are non-transactional on MySQL) and #19 (
SqlPlatform, with MariaDB as a platform of its own).Related PRs:
#168⏭️#174⏭️#116⏭️#199⏭️#371⏭️#342🩹 ⏭️#51⏭️#210🩹 ⏭️#242🩹 ⏭️#135⏭️#440⏭️#50⏭️#206⏭️#1545⏭️#54⏭️#18⏭️#170⏭️#191⏭️#156⏭️#67⏭️#174🩹 ⏭️#175⏭️#130⏭️#193🩹 ⏭️🔄 = this branch adds an upgrade migration (renames/FK-retargets existing schema), not just a fresh baseline.
⚠️ = fixes a different, related problem (missing
🩹 = this branch also received a backported delta migration, converted from a legacy
ibexa/installerupgrade/db/*.sqlscript (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.SchemaBuilderEventsupport 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 throughand 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.Alternative to #784, using the same
IbexaMigrationInterface+IbexaMigrationTag+TaggedMigrationsRunner/IbexaOnlyDependencyFactorymechanism, but withInstallSchemaMigration/ImportDataMigrationimplemented as plainDoctrine\Migrations\AbstractMigrationsubclasses with all SQL inlined directly in PHP (viaaddSql()), instead of Ibexa'sAbstractVersion+ YAML manifest + one-SQL-statement-per-file mechanism. This drops the 509 generated YAML/SQL resource files in favor of two self-contained PHP migration classes.Adds an
ibexa/doctrine-migrations-based alternative to the event-drivenSchemaBuilderEventmechanismCoreInstallercurrently uses to install the core schema and bootstrap data, controlled by a newibexa.installer.schema_builder_event.enabledsetting (defaults totrue, preserving current behavior).CoreInstallerkeeps dispatchingSchemaBuilderEventand importingcleandata.sqldirectly - unchanged.InstallSchemaMigration,ImportDataMigration), tagged withIbexaMigrationTagfor discovery, and executed viaTaggedMigrationsRunnerthroughIbexaOnlyDependencyFactory- an independent Doctrine MigrationsDependencyFactoryscoped to only Ibexa-tagged migrations, so a project's own migrations are never accidentally picked up. The runner hands each migration to Doctrine's Migrator (DependencyFactory::getMigrator()), the same oneibexa:doctrine:migrations:migrateuses, so each runs in its own transaction where the platform allows it, and a failure throwsMigrationFailedException, naming the migration it came from. Each migration's execution is recorded in the standard Doctrine Migrations versioning table, making repeated installs idempotent.InstallSchemaMigration's SQL (mysql/postgresql/sqlite) is generated from the existingschema.yaml;ImportDataMigration's SQL is generated from the existing per-DBMScleandata.sqlfiles, with the mysql statements also reused verbatim for sqlite (which previously had no cleandata support at all). Long or naturally multi-line statements (CREATE TABLE, multi-rowINSERT, longALTER TABLE ... ADD CONSTRAINT) use PHP NOWDOC for readability; verified byte-for-byte equivalent (aside from whitespace) to the SQL produced by #784.Requires
ibexa/doctrine-migrations(~4.6.x-dev).OrmEntitiesSchemaSubscriber, which contributes the tables of plain Doctrine ORM entities toSchemaBuilderEvent(ibexa/taxonomy#431 and ibexa/connector-payum#39 use it), was extracted into #852 and is already on 4.6, so it's no longer part of this PR.For QA:
ibexa-4.6-install-matrix.sh(below) installs Ibexa DXP 4.6 with this PR and the other IBX-11939 4.6 PRs pinned in, for headless, experience and commerce on MariaDB, MySQL and PostgreSQL - 9 installs, each into a fresh database. It uses the Doctrine Migrations install path by default;-p legacyruns the oldSchemaBuilderEventpath into separate databases, and once both have run, the script also compares their tables.You'll need Docker, PHP 7.4-8.3, composer 2 with
updates.ibexa.cocredentials that can see development branches (plus a GitHub token for the ibexa org), and node with yarn 1.x - the installer's data migrations need built assets.--skip-assetsstubs them out if you only care about the database, but then the back office can't be browsed.An install is marked OK when
ibexa:installsucceeds, the database has content and an admin user, the log shows the expected path ran, thedoctrine:schema:updatethe installer runs part-way through has nothing left to create, and - on the migrations path - every tagged migration was executed. What I got locally, the same on all three databases:The logs show a few "Migration ... was executed but did not result in any SQL statements" warnings - those are index migrations with nothing to add on a fresh install. ibexa/oauth2-server#48 isn't part of any edition, so it isn't covered.
--helplists the rest (a single edition or database, other images and ports,--teardown).To switch an existing 4.6 project over by hand instead, you need this PR and the other IBX-11939 4.6 PRs installed; the script's
BRANCHESmap lists them.ibexa/doctrine-migrationscomes in through ibexa/installer#213 but has no Flex recipe yet, so register its bundle next toDoctrineMigrationsBundle, which the 4.6 skeletons already have:Then turn off the event-driven schema building. It defaults to
true, which keeps the oldSchemaBuilderEventpath:After clearing the cache,
ibexa:installruns the tagged migrations instead. The log then says "Executed N queries on database" with no progress bar, where the old path says "Executing N queries" with one.ibexa:doctrine:migrations:statusshould show nothing new afterwards. Withenabled: falsebut no bundle,ibexa:installstops at the schema import with an error naming the missing service.ibexa-4.6-install-matrix.shChecklist:
$ composer fix-cs).@ibexa/engineering).