Conversation
Contributor
|
Preview deployment: https://add-missing-migration.preview.avy-fx.org |
Contributor
|
🚀 This is included in version v1.9.1 |
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.
Description
Fixes the migration JSON snapshot in
20260131_012456_remove_wrap_in_container.jsonwhich still referenced the oldbutton_appearancecolumn name instead ofbutton_variant. This caused Payload to repeatedly suggest creating a migration to renameappearancetovariant— a migration that already exists.Related Issues
Caused by #899 (Improve and simplify
wrapInContainerbehavior with background color picker). That PR's migration snapshot was generated from a schema state that predated thebutton_appearance→button_variantrename from #892 (Clean up how we use links). Since theremove_wrap_in_containermigration is the last in the list, its stale snapshot became the baseline Payload compares against, causing a perpetual diff.Key Changes
20260131_012456_remove_wrap_in_container.jsonto replace 8 occurrences ofbutton_appearancewithbutton_variant, matching the actual database state after migration20260128_213937_rename_appearance_to_variantrunsHow to test
pnpm payload migrate:create— it should report no schema changes needed (previously it would generate a rename migration every time)Migration Explanation
No new migration. This corrects the JSON snapshot of an existing migration so Payload's schema diffing works correctly.
Future enhancements / Questions
When creating migrations on branches, we should ensure the latest snapshot reflects all prior migrations in the chain. This can happen when two PRs with migrations are developed in parallel — whichever merges second may have a snapshot that doesn't include the first PR's changes.