Skip to content

IBX-11939: Merged branch '5.0' into 6.0 - #49

Merged
Steveb-p merged 5 commits into
6.0from
merge/5.0-to-6.0
Oct 12, 2026
Merged

Steveb-p merged 5 commits into
6.0from
merge/5.0-to-6.0

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Caution

This is a merge pull request

🎫 Issue IBX-11939

Related PRs:

* Add Doctrine Migrations baseline for ibexa/messenger (new at 5.0)

Adds InstallSchemaMigration tagged 5.0.0 (the package's introduction version,
no pre-5.0 legacy state to reconcile). SQL generated via
ibexa:doctrine:schema:dump-sql from the current schema.yaml and verified
end-to-end against a real SQLite connection - resulting tables match a
fresh dump-sql exactly.

Existing schema.yaml + BuildSchemaEventSubscriber left untouched.

* Fix CI: add ibexa/doctrine-migrations dependency, remove extra blank lines

composer.json was missing ibexa/doctrine-migrations (require + matching
VCS repository entry for its unreleased dev branch), causing "Class
Doctrine\Migrations\AbstractMigration not found" across static analysis,
unit tests, and browser tests - mirrors ibexa/core's own composer.json
pattern exactly (same dev-branch constraint per major version).

Also removes extra blank lines the generator scripts introduced (before
each } elseif and the up() method's closing brace) that php-cs-fixer's
no_extra_blank_lines rule flagged.

* IBX-11939: Adopted AbstractSqlMigration for platform-separated SQL

Extends AbstractSqlMigration (added in ibexa/doctrine-migrations) instead of the plain
Doctrine AbstractMigration, replacing `$this->platform instanceof ...` checks with
isMySQL()/isPostgreSQL()/isSqlite(), and moving each platform Statement block out of the
PHP file into its own sql/*.sql file loaded via addSqlFile().

Mechanical, content-preserving change: every migration was run before and after against
all three platforms and the resulting SQL statement lists are byte-for-byte identical.

* IBX-11939: Aborted migration on unsupported database platform

Call abortIfUnsupportedPlatform() as the first statement of up(), so
installs on a database this migration doesn't build SQL for fail loudly
instead of silently queuing zero statements.

* IBX-11939: Added trailing semicolons to migration SQL files

Each statement now ends with `;`, matching ibexa:doctrine:schema:dump-sql's
own convention, so the files are directly executable via mysql/psql/sqlite3
CLI clients. addSqlFile() still splits on the delimiter and passes one
statement per addSql() call, unaffected by the trailing terminator.

* IBX-11939: Added schema-presence guards to skip already-applied migrations

Checks $schema (already the live, introspected database) before running,
and skipIf()s when the tables/columns/FK targets this migration would
create already exist -- so installs that built their schema the old way
(SchemaBuilderEvent) can adopt Doctrine Migrations without every migration
aborting or duplicating existing schema objects.

* IBX-11939: Recorded schema-guarded migrations as applied, not skipped

Doctrine Migrations only calls MetadataStorage::complete() (the write to
doctrine_migration_versions) when a migration's up() returns normally --
never when it throws SkipMigration. So every migration using skipIf() was
being silently re-evaluated on every future doctrine:migrations:migrate
run instead of being permanently recorded as applied, even though its
guard condition (the schema already being in place) never changes back.

Replaces every `$this->skipIf($condition, $message);` with
`if ($condition) { return; }`: up() now returns normally with zero queued
SQL when the guard fires, so the migration is correctly recorded as
executed (with a "did not result in any SQL statements" warning logged,
which is expected and harmless) and never re-evaluated again.

Verified end-to-end: fresh ibexa:install (schema_builder_event enabled)
followed by doctrine:migrations:migrate now records all 44 tagged
migrations in doctrine_migration_versions in one pass, and a second
migrate run does zero work at all ("Already at the latest version").

* IBX-11939: Removed ibexa/doctrine-migrations VCS repository entry

ibexa/doctrine-migrations is now published on Packagist (which mirrors all
of its branches, not just tags), so the explicit VCS repository pointing
composer directly at GitHub is no longer needed to resolve the dev-branch
require constraint.

* IBX-11939: Corrected ibexa_messenger_messages index declaration in schema.yaml

schema.yaml declared 3 separate, explicitly-named single-column indexes
(created_at/available_at/delivered_at), but this table is Symfony's own
Doctrine Messenger transport table - its real shape (as created by
symfony/doctrine-messenger's own Connection::buildSchemaTable()) is ONE
composite index over (queue_name, available_at, delivered_at, id). Replaced
the 3-index declaration with a single named index matching that exact column
set and order, so a legacy SchemaBuilderEvent install now produces a schema
consistent with what Symfony's own transport expects, instead of a
permanently-diverging one. Verified via ibexa:doctrine:schema:dump-sql.

* IBX-11939: Added migration to fix already-installed ibexa_messenger_messages indexes

Correcting schema.yaml alone (previous commit) only fixes NEW installs going
through the legacy SchemaBuilderEvent path - it does nothing for installs
that already ran the old InstallSchemaMigration (guarded against re-running
once the table exists) or an old legacy install that already created the
wrong 3-index shape.

- InstallSchemaMigration's own baseline SQL files (all 3 platforms) now
  create the correct single composite index directly, so a brand-new
  Doctrine-Migrations install never creates the wrong shape in the first
  place.
- New FixMessengerMessagesIndexesMigration (tagged 5.0.0, dated after the
  baseline) drops the 3 incorrect indexes and creates the correct composite
  one, guarded to skip if the correct index is already present - so it's a
  no-op on fresh installs (baseline already got it right) and a real fix on
  anything installed before this correction (whichever install path it went
  through).

Verified against a real SQLite connection: fresh install produces 0 pending
statements from the fix migration; a table seeded with the old wrong shape
produces exactly 4 statements (3 drops + 1 create) and becomes correct;
re-running the fix migration afterwards is a no-op (idempotent).

* IBX-11939: Resolved ibexa/doctrine-migrations from its own branch

The dev-feat/doctrine-migrations-* branches predate the package having real 5.0 and 6.0 branches;
those now exist and carry the same code, so the normal tier constraint resolves it.

* IBX-11939: Used the ORM index name for ibexa_messenger_messages

The install SQL and the FixMessengerMessagesIndexesMigration upgrade path both created
the composite index as ibexa_messenger_messages_queue_available_delivered_idx, while
the SchemaBuilderEvent path produces the name Doctrine derives from the mapping,
IDX_837A775AFB7336F0E3BD61CE16BA31DBBF396750. doctrine:schema:update renamed it on
every migrations-based install.

The migration guard that short-circuits on an already-fixed database was checking the
old name too, so it has to move with the SQL - otherwise the migration stops
recognising a fresh install and its DROP INDEX statements fail.

* IBX-11939: Replaced SqlPlatform with doctrine-schema's DatabasePlatformName

* IBX-11939: Wrapped long lines in the Doctrine Migrations SQL files

* IBX-11939: Added MariaDB to the platforms the migrations support

doctrine-migrations 5.0 takes SqlPlatform now, with MariaDB as a platform of its own
(ibexa/doctrine-migrations#19), so each migration lists SqlPlatform::MARIADB and runs its
MySQL SQL there too.
…olumns into identity columns on 6.0 (#23)

* IBX-11939: Removed the Doctrine type comments left by the 4.6 and 5.0 install migrations

Doctrine DBAL 4 no longer writes type comments such as (DC2Type:datetime_immutable),
so a fresh 6.0 install through the schema builder has none, while a database
installed or upgraded through the migrations kept them.

* IBX-11939: Turned the PostgreSQL SERIAL columns into identity columns

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.

* IBX-11939: Dropped the check before removing the type comments

Running the statements on columns that have no comment changes nothing: MySQL
and MariaDB do the MODIFY as an instant, metadata-only change, and PostgreSQL's
COMMENT ON COLUMN ... IS NULL is a no-op. So the check bought nothing. Raised
in review on ibexa/activity-log#167.

* IBX-11939: Replaced the SERIAL conversion loop with plain SQL statements

sql/convert-serial-columns-to-identity-postgresql.sql was a PL/pgSQL DO
block that looped over the columns, read each one's sequence from
information_schema and skipped a column that was no longer SERIAL. It
now holds the plain statements for each column, so it can be read and
run by hand.

The check moved to the migration. Doctrine DBAL 4 reports only identity
columns as autoincrement, and PostgreSQL runs the migration in one
transaction, so the first column tells whether the columns are converted
already, as on a database a 6.0 SchemaBuilderEvent install created.
* IBX-11939: Skipped removing the type comments when there are none

A database installed with SchemaBuilderEvent on 6.0 and migrated later has
no Doctrine type comments, so the statements have nothing to do there. The
check reads the comments from the schema Doctrine Migrations passes in.

* IBX-11939: Typed the TABLES constant

Class constants can declare their type since PHP 8.3, and 6.0 requires
PHP 8.5.
)

* IBX-11939: Moved the Doctrine Migrations service definitions to PHP

The 5.0 -> 6.0 merge-up added `doctrine_migrations.yaml` as a new file. New service definition files are PHP
on 6.0, so the definitions now live in the PHP file of the same name, loaded by a
PhpFileLoader in the bundle extension, as in translations-management. The services are
defined the same way as before.
@Steveb-p
Steveb-p merged commit 8b836b8 into 6.0 Oct 12, 2026
5 of 6 checks passed
@Steveb-p
Steveb-p deleted the merge/5.0-to-6.0 branch October 12, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fast-forward merge PR should be merged in a fast-forward way

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants