From e2a772b1a14a5e1f6a606312f5f404e76ba0eb58 Mon Sep 17 00:00:00 2001 From: Mark Scherer Date: Tue, 30 Jun 2026 15:21:20 +0200 Subject: [PATCH] Quickstart: run migrations after correcting the join-table migration 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. --- docs/en/tutorials-and-examples/cms/database.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/en/tutorials-and-examples/cms/database.md b/docs/en/tutorials-and-examples/cms/database.md index ca163bb88a..32b1d38543 100644 --- a/docs/en/tutorials-and-examples/cms/database.md +++ b/docs/en/tutorials-and-examples/cms/database.md @@ -66,9 +66,6 @@ bin/cake bake migration CreateUsers email:string password:string created modifie bin/cake bake migration CreateArticles user_id:integer title:string slug:string[191]:unique body:text published:boolean created modified bin/cake bake migration CreateTags title:string[191]:unique created modified bin/cake bake migration CreateArticlesTags article_id:integer:primary tag_id:integer:primary created modified - -# Run migrations to create tables -bin/cake migrations migrate ``` ```php [Migration Example] @@ -120,6 +117,12 @@ $table->addColumn('tag_id', 'integer', [ Remove the `autoIncrement` lines before running the migration to prevent foreign key problems. ::: +Once the `articles_tags` migration is corrected, run the migrations to create the tables: + +```bash +bin/cake migrations migrate +``` + #### Adding Seed Data Create seed files to populate initial data: