Quickstart: run migrations after correcting the join-table migration#8318
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the CMS quickstart database section, the
[Commands]block bundlesbin/cake migrations migratetogether 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 migrateThe baked
articles_tagsmigration 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 runsmigratebefore reaching the warning and hits the error.Reported in cakephp/cakephp#19524.
Fix
Move
bin/cake migrations migrateout of the bake block to after the warning, so the documented order is: bake -> correct thearticles_tagsmigration -> 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.