Fix checkSync() to only consider migrations from current context#1061
Open
dereuromark wants to merge 1 commit into5.xfrom
Open
Fix checkSync() to only consider migrations from current context#1061dereuromark wants to merge 1 commit into5.xfrom
dereuromark wants to merge 1 commit into5.xfrom
Conversation
73d4ac8 to
b7d34d5
Compare
When using the unified `cake_migrations` table, `BakeMigrationDiffCommand::checkSync()` was comparing the last migrated version (from ALL contexts including plugins) against the last migration file in the current context (app or specific plugin). This caused false "not in sync" errors when a plugin had more recent migrations than the app being baked. The fix filters migrated versions to only consider those that have corresponding files in the current context before comparing. Fixes #1060
b7d34d5 to
f606ec1
Compare
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.
Summary
Fixes #1060
When using the unified
cake_migrationstable,BakeMigrationDiffCommandhad two issues:setup()didn't filter migrations by context: The query for migrated items fetched ALL migrations fromcake_migrationswithout filtering by the current plugin. This caused issues when baking diffs for plugins.checkSync()compared wrong versions: It compared the last migrated version (from ALL contexts) against the last migration file in the current context only.Symptoms
This happened when a plugin had more recent migrations than the app being baked.
Fix
Filter
migratedItemsby plugin context insetup(): In unified table mode, the query now includesWHERE plugin IS :pluginto only fetch migrations for the current context.Context-aware
checkSync(): The method now filters migrated versions to only those that have corresponding migration files in the current context before comparing.Testing
Added
testCheckSyncWithPluginMigrationsMoreRecent()that: