Reduce migration complexity and add 49 boundary regression tests - #195
Merged
Merged
Conversation
Add 49 behavioral cases covering culture-independent SQL literals, quoted identifiers, schema-scoped metadata, constraint aliases and composite order, reader cleanup, SQLite self references, and caller-owned transactions. Make fallback column removal prepare all dependency changes before DDL and rebuild related tables atomically. Preserve dependent constraints and rows when rebuilding the parent fails; handle column references case insensitively. Reuse dialect quoting in preview and return COLUMN_NAME from GetColumns. Separate catalog query selection from parsing and use explicit lookups for constraint aliases and numeric literal types. Reduce Literal complexity from 44 to 24, RemoveColumn from 70 to 34, and the largest constraint-reading method from 76 to 20 (including extracted helpers). Validation: all 1,149 local unit/SQLite tests pass. Seven new regression cases failed before fixes. Comparable local coverage: lines 56.13% -> 57.37%, branches 49.87% -> 51.41%. Full external-database coverage awaits CI.
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.
This follow-up adds 49 behavioral tests and reduces migration risk in SQL preview, catalog parsing, and SQLite schema reconstruction.
Behavior changes
Validation
All 1,149 local unit/SQLite tests pass (49 added). Seven new regression cases failed before the fixes and passed afterward. The tests include injected rebuild failure, caller rollback, self-references, actual SQLite execution of preview SQL, numeric boundaries under de-DE culture, catalog key ordering/type aliases, and reader disposal on errors.
Comparable local Coverlet/ReportGenerator results:
Extracted helpers are included in review: CatalogQuery has complexity 20 / CRAP 91, CreateConstraint and ReadConstraints each 8 / 8; SQLite native eligibility is 18 / 18, validation 14 / 15, and transaction orchestration 10 / 10. Complexity reduction at entry points includes responsibility separation; it does not mean those helper paths disappeared.
The downloaded merged CI report had 86.10% line and 78.63% branch coverage. It includes external-database suites, whereas these before/after measurements use the same local unit/SQLite filter. Updated merged coverage requires CI; these percentages must not be compared as a regression from 86.10%.
Local commands: dotnet test src/Migrator.Tests/Migrator.Tests.csproj --no-restore with the existing external-database category exclusions, XPlat Code Coverage and .github/coverage.runsettings; NUnit.NumberOfTestWorkers=0. git diff --check passes. Existing build warnings remain.