Skip to content

IBX-11939: Fixed messenger's index migration after legacy installs and in a dry run - #52

Merged
Steveb-p merged 4 commits into
5.0from
feature/schema-late-install-5.0
Oct 28, 2026
Merged

Steveb-p merged 4 commits into
5.0from
feature/schema-late-install-5.0

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11939

Related PRs:

Description:

FixMessengerMessagesIndexesMigration replaces the 3 per-column indexes of the original schema with the composite one Symfony's Doctrine transport declares, which DBAL names IDX_837A775AFB7336F0E3BD61CE16BA31DBBF396750. It decided whether to run by looking for that name only. #22 gave the composite index to schema.yaml as well, but called it ibexa_messenger_messages_queue_available_delivered_idx. On 5.0, ibexa:install renames it to Symfony's name in its doctrine:schema:update step, so nothing showed. On 6.0 that step leaves the messenger table alone, so after a legacy install ibexa:doctrine:migrations:migrate ran the migration and failed on its first DROP INDEX ibexa_messenger_created_at_idx (MySQL 1091 Can't DROP, PostgreSQL 42704 index ... does not exist). Legacy being 6.0's default install path, that blocks the migrate step documented for adding a package.

schema.yaml now names the index IDX_837A775AFB7336F0E3BD61CE16BA31DBBF396750. ibexa/doctrine-schema only takes named indexes, so it has to be spelled out. Fresh installs on both paths now end with the same name, and Symfony's own schema declaration agrees.

FixMessengerMessagesIndexesMigration also runs only when ibexa_messenger_created_at_idx is there, so a table without the old indexes is left alone. That's the case for a 6.0 legacy install made with the schema.yaml from #22: it keeps ibexa_messenger_messages_queue_available_delivered_idx, which covers the same columns. No release contains #22 yet, so changing the migration's condition only affects development databases.

The first and last commits fix migrate --dry-run: a dry run executes nothing, so the migration got a schema without ibexa_messenger_messages when the package is installed in the same run, and getTable() threw. It now skips when the table isn't there, so the dry run lists it as skipped and says why. In a real run the table always exists by then.

Checked in a 5.0 and a 6.0 commerce project on MySQL 8.0, MariaDB 10.11, PostgreSQL 16 and SQLite: the migration turns a table with the 3 per-column indexes into exactly the fresh install's, and installing the package late, --dry-run first, ends identical to a fresh install. On MySQL, MariaDB and PostgreSQL it skips a table under either composite name, a 6.0 legacy install followed by migrate passes now, fresh legacy installs equal fresh Doctrine Migrations installs by index name, and the 4.6 upgrades are unchanged.

For QA:

On a 6.0 project installed the legacy way (without doctrine_migrations: true):

php bin/console ibexa:doctrine:migrations:migrate

It passes now; before, it failed in FixMessengerMessagesIndexesMigration with Can't DROP 'ibexa_messenger_created_at_idx'.

…s exist

A dry run executes nothing, so every migration in it gets the schema as it
was before the run. FixMessengerMessagesIndexesMigration read a table that
an earlier migration creates, which threw. It now returns when the table
isn't in the schema; in a real run, it always is.
…ort does

symfony/doctrine-messenger declares the (queue_name, available_at,
delivered_at, id) index without a name, so Doctrine DBAL names it
IDX_837A775AFB7336F0E3BD61CE16BA31DBBF396750. The Doctrine Migrations
baseline and FixMessengerMessagesIndexesMigration create it with that name,
while schema.yaml called it
ibexa_messenger_messages_queue_available_delivered_idx.

On 5.0, ibexa:install's doctrine:schema:update renamed it right after a
SchemaBuilderEvent install, but on 6.0 it doesn't, so a 6.0 legacy install
kept the other name, and FixMessengerMessagesIndexesMigration, which looks
for IDX_837A..., tried to replace indexes the table never had.
ibexa/doctrine-schema only takes named indexes, so schema.yaml now names it
explicitly.
…t there

The migration replaced the per-column indexes of the original schema
whenever the table had no IDX_837A775AFB7336F0E3BD61CE16BA31DBBF396750. A
table created under another name for that index has none of them, so its
first DROP INDEX failed. It now also checks that
ibexa_messenger_created_at_idx exists.
…before the table exists

A dry run executes nothing, so when it installs the package, the table that
FixMessengerMessagesIndexesMigration inspects isn't in its schema. The migration
returned then, which the dry run reported as executed without SQL
statements. It now skips, and the dry run says why. In a real run the table
always exists by then.
@Steveb-p
Steveb-p marked this pull request as ready for review October 26, 2026 14:07
@Steveb-p
Steveb-p merged commit 197d1fa into 5.0 Oct 28, 2026
14 checks passed
@Steveb-p
Steveb-p deleted the feature/schema-late-install-5.0 branch October 28, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants