Skip to content

TASK: Use migrations in pipeline and fixed migrations for MariaDB 12.x#3571

Open
dlubitz wants to merge 1 commit into
neos:8.3from
dlubitz:task/test-migrations
Open

TASK: Use migrations in pipeline and fixed migrations for MariaDB 12.x#3571
dlubitz wants to merge 1 commit into
neos:8.3from
dlubitz:task/test-migrations

Conversation

@dlubitz

@dlubitz dlubitz commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What I did

Some old Flow migrations dropped foreign keys by their hardcoded auto-generated names (e.g. ..._ibfk_1). These names are no longer reliable: on MariaDB 12+, renaming a table no longer renames its auto-generated foreign key/index names along with it, so the constraint names the migrations expect may not exist and the migrations fail.

Instead of relying on hardcoded constraint names, the affected migrations now look up the actual foreign keys on the table via the schema manager and drop the one defined on the relevant column. This works regardless of what the constraint is actually named, making the migrations compatible with MySQL, MariaDB < 12 and MariaDB ≥ 12 alike.

Why the CI change

Until now this breakage went unnoticed because the pipeline never executed the Doctrine migrations. The build workflow now runs ./flow doctrine:migrate before the functional tests, so the full migration chain is verified on every build.

@dlubitz dlubitz self-assigned this Jun 5, 2026
Comment thread Neos.Flow/Migrations/Mysql/Version20110923125535.php

@bwaidelich bwaidelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the description.
So I guess we accept the fact that a down migration would not re-add the FK constraints, right?

@dlubitz

dlubitz commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Yes and no. If you only go down one version, this will not be an issue, as the table has not been renamed in meanwhile.

But if you would go down many versions until the renaming, this might have an effect. But TBH, this shouldn't be a valid use case.

AND target should be anyways to get rid of these old old migrations by compression.

@bwaidelich bwaidelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, thanks!
+1 by reading

Comment on lines +159 to +160
- name: Run migrations to test if they work
run: FLOW_CONTEXT=Testing ./flow doctrine:migrate

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 def makes sense to include that ... even though the functional test will use sqlite and thus not use the prepared database ...


if ($this->isPartyPackageInstalled()) {
$this->addSql("ALTER TABLE typo3_flow3_security_account DROP FOREIGN KEY typo3_flow3_security_account_ibfk_1");
foreach ($this->sm->listTableForeignKeys('typo3_flow3_security_account') as $foreignKey) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill find these migrations super hard to read now ... i think we discussed multiple times to have a merged migration state with Neos 10.0 neos/neos-development-collection#5656 can you say if we also need to use these kind of checks when the migrations are compacted or is this then an issue of the past?

TBH i dont understand why we not just define the names of the foreign keys during the creation and thus never have the problem of anything being "random" or autogenerated...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This question is to late. As we already have this situation now and we need to handle that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully understood. I meant i am more willing to accept this state if we know its definitely just $temporary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but i dont understand the problem well enough still because

why we not just define the names of the foreign keys during the creation and thus never have the problem of anything being "random" or autogenerated...

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