Skip to content

Quickstart: run migrations after correcting the join-table migration#8318

Merged
dereuromark merged 1 commit into
5.xfrom
quickstart-join-table-migrate-order
Jun 30, 2026
Merged

Quickstart: run migrations after correcting the join-table migration#8318
dereuromark merged 1 commit into
5.xfrom
quickstart-join-table-migrate-order

Conversation

@dereuromark

Copy link
Copy Markdown
Member

Problem

In the CMS quickstart database section, the [Commands] block bundles bin/cake migrations migrate together with the bake commands:

bin/cake bake migration CreateUsers ...
bin/cake bake migration CreateArticles ...
bin/cake bake migration CreateTags ...
bin/cake bake migration CreateArticlesTags article_id:integer:primary tag_id:integer:primary created modified

# Run migrations to create tables
bin/cake migrations migrate

The baked articles_tags migration needs a manual fix first - its composite primary key columns are generated as auto-increment, which MySQL rejects with error 1075. That fix is documented in the "Composite Primary Key Adjustment" warning, but the warning comes after the migrate step. A reader who copies the whole block runs migrate before reaching the warning and hits the error.

Reported in cakephp/cakephp#19524.

Fix

Move bin/cake migrations migrate out of the bake block to after the warning, so the documented order is: bake -> correct the articles_tags migration -> migrate.

Note

The underlying bake behavior is fixed in cakephp/migrations#1095 (composite primary keys no longer auto-increment). Once a migrations release including that fix is out, the manual-adjustment warning here can be removed. Until then this keeps the quickstart from failing for current users.

The CMS quickstart bundled `bin/cake migrations migrate` in the same
copy-paste block as the bake commands. The baked articles_tags migration
needs a manual fix first (the composite primary key columns are generated
as auto-increment, which MySQL rejects), but that warning came after the
migrate step. Copying the whole block ran migrate before the fix and failed.

Move the migrate step to after the composite primary key warning so the
order is: bake, correct the migration, then migrate.
@dereuromark dereuromark merged commit 36f4721 into 5.x Jun 30, 2026
6 checks passed
@dereuromark dereuromark deleted the quickstart-join-table-migrate-order branch June 30, 2026 13:55
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.

1 participant