Repository navigation
fix(cli): Don't detect column renames for live columns that still exist in the target - #5920
Open
ChandraChaan wants to merge 2 commits into
Open
ChandraChaan wants to merge 2 commits into
ChandraChaan wants to merge 2 commits into
Conversation
…st in the target Fixes serverpod#5915
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
I merged
This PR only touches |
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.
generateTableMigrationmatches source and target columns byeffectiveFieldName, which falls back to the column name whenfieldNameis null. A schema read from a live database never has field names, so when a model maps fields to each other's column names (first: String, column=second/second: String, column=first), each live column was matched to the wrong field and the diff reported a rename cycle (first → second,second → first) for a table that is already in sync. The generated SQL can't run either, because each target name still exists when its rename runs.Source columns without a stored
fieldNameare now only considered for a rename when their name no longer exists in the target. If the target still has a column with that name, it's the same physical column, as the issue suggests. Columns with a storedfieldNameare matched exactly as before.Tests in
column_rename_test.dart:The swapped-columns test fails without this change.
dart test test/databaseintools/serverpod_clipasses (773 tests).Fixes #5915
Pre-launch Checklist
///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar. (not applicable: no public API changed)Breaking changes
None.