test(migrator): pin SQLite text-affinity normalization for migrate diff - #3588
Merged
Conversation
Issue #3565's spurious `text -> string` changes were already fixed by #3584 (inline normalization in AutoMigrator.diff()), but the behavior had no test coverage and the normalization was inlined. Extract it into $normalizeMigTypeForDiff() and unit-test the affinity families so the fix can't regress. The method returns the expected type when SQLite's TEXT storage class was probed ("text") but the model introspected a string-like type (string, text, datetime, date, time, boolean), and otherwise returns the actual type unchanged. diff() now calls it in place of the inline conditional. Signed-off-by: Peter Amiri <peter@alurium.com>
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.
Closes #3565.
Finding
wheels migrate diffon SQLite no longer emits spurioustext → stringchanges — that was already fixed by #3584 (the inline normalization inAutoMigrator.diff()). I reproduced the issue's exact scenario on a scaffolded app with string/text/datetime columns andmigrate diffis clean.But the fix shipped with no test coverage, so it could regress silently. This PR pins it.
Change
$normalizeMigTypeForDiff(actualMigType, expectedMigType)(public for specs, same carve-out as$cfSqlTypeToMigrationType/$dbTypeToMigrationType).diff()now calls it instead of the inline conditional — behavior-preserving.Verification
bash tools/test-local.sh migrator: 300 passed, 0 failed (8 new tests).wheels migrate diffon a Beat-1–7 demo app (string/text/datetime/decimal columns): "No differences found".