Skip to content

test(migrator): pin SQLite text-affinity normalization for migrate diff - #3588

Merged
bpamiri merged 1 commit into
developfrom
peter/migrate-diff-affinity-tests
Sep 11, 2026
Merged

test(migrator): pin SQLite text-affinity normalization for migrate diff#3588
bpamiri merged 1 commit into
developfrom
peter/migrate-diff-affinity-tests

Conversation

@bpamiri

@bpamiri bpamiri commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #3565.

Finding

wheels migrate diff on SQLite no longer emits spurious text → string changes — that was already fixed by #3584 (the inline normalization in AutoMigrator.diff()). I reproduced the issue's exact scenario on a scaffolded app with string/text/datetime columns and migrate diff is clean.

But the fix shipped with no test coverage, so it could regress silently. This PR pins it.

Change

  • Extracted the inline SQLite TEXT-affinity normalization into a public $normalizeMigTypeForDiff(actualMigType, expectedMigType) (public for specs, same carve-out as $cfSqlTypeToMigrationType / $dbTypeToMigrationType).
  • diff() now calls it instead of the inline conditional — behavior-preserving.
  • Added 8 unit tests covering the affinity families (text→string/text/datetime/date/time/boolean all normalize; text→integer and non-text actuals do not).

Verification

  • bash tools/test-local.sh migrator: 300 passed, 0 failed (8 new tests).
  • Live wheels migrate diff on a Beat-1–7 demo app (string/text/datetime/decimal columns): "No differences found".

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>
@bpamiri
bpamiri merged commit 42a3c74 into develop Sep 11, 2026
15 checks passed
@bpamiri
bpamiri deleted the peter/migrate-diff-affinity-tests branch September 11, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrate diff: SQLite reports spurious text → string changes for every string/text/datetime column

1 participant