Skip to content

Commit 36f4721

Browse files
authored
Quickstart: run migrations after correcting the join-table migration (#8318)
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.
1 parent 6537472 commit 36f4721

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

docs/en/tutorials-and-examples/cms/database.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ bin/cake bake migration CreateUsers email:string password:string created modifie
6666
bin/cake bake migration CreateArticles user_id:integer title:string slug:string[191]:unique body:text published:boolean created modified
6767
bin/cake bake migration CreateTags title:string[191]:unique created modified
6868
bin/cake bake migration CreateArticlesTags article_id:integer:primary tag_id:integer:primary created modified
69-
70-
# Run migrations to create tables
71-
bin/cake migrations migrate
7269
```
7370

7471
```php [Migration Example]
@@ -120,6 +117,12 @@ $table->addColumn('tag_id', 'integer', [
120117
Remove the `autoIncrement` lines before running the migration to prevent foreign key problems.
121118
:::
122119

120+
Once the `articles_tags` migration is corrected, run the migrations to create the tables:
121+
122+
```bash
123+
bin/cake migrations migrate
124+
```
125+
123126
#### Adding Seed Data
124127

125128
Create seed files to populate initial data:

0 commit comments

Comments
 (0)