Repository navigation
Description
Problem
Nothing applies a SQL Server migration to a SQL Server. The integration job (Integration (PostgreSQL 18)) runs PostgreSQL only, and every SQL Server test compares rendered SQL or the operation list. That layer cannot see what SQL Server refuses or accepts when the migration is applied, and the 5.5.0 analysis found three such defects:
- SQL Server: ALTER COLUMN on a column under a complex index fails at apply (Msg 5074) #84:
ALTER COLUMNon a column under a complex index failed at apply with Msg 5074. - SQL Server: a unique complex index over nullable columns admits only one row without a value #88 (silent): a unique complex index over nullable columns admitted one row without a value and refused the second. It was hidden because
MigrationHarness.SqlServerSqlrenders withmodel: null, which adds EF's legacyIS NOT NULLfilter thatdatabase updatenever adds (Tests: seeded defects in the core and SQL Server differs that the suite does not catch, and the model-less SQL Server rendering #96). - SQL Server: a second clustered complex index in a later migration, and an index named like the table's key, fail only at apply #90: a second clustered complex index in a later migration, and an index named like the table's key, fail only at apply.
The SQL Server satellite is at 91% line and 79% branch coverage, so more SQL-text tests would mostly re-assert what is already asserted. The missing layer is the server.
Change
- The lane: a
TestCategory=Integrationclass overTestcontainers.MsSql(mcr.microsoft.com/mssql/server:2022-latest, which runs onubuntu-latest), and a CI jobIntegration (SQL Server 2022)beside the PostgreSQL one, withCI=trueso an unavailable container fails instead of going inconclusive. The tests live in their own project,test/EFCore.ComplexIndexes.SqlServer.IntegrationTests, which references only the core package and the SqlServer satellite; the shared harness is linked in or moved into a small shared project. That way a PostgreSQL-only, docs or test-only PR can skip the lane once lanes are selected (#112). The job is a lane theCIgate checks (CI: one gate job as the only required build check #110), not a new entry in the branch protection's required checks; whenrelease/5.xis cut, it requiresCI. - What it applies, each through
migrations add's operations and the context's runtime services, asdatabase updatedoes:- every SQL Server index option the satellite whitelists (
INCLUDE,FILLFACTOR,ONLINE,SORT_IN_TEMPDB,DATA_COMPRESSION, clustered), property-level and entity-level - placeholder filters
- a rename, a table rename, and an
ALTER COLUMNunder an index (SQL Server: ALTER COLUMN on a column under a complex index fails at apply (Msg 5074) #84) - the clustered-slot cases of SQL Server: a second clustered complex index in a later migration, and an index named like the table's key, fail only at apply #90
- every SQL Server index option the satellite whitelists (
- What it reads back: the result from
sys.indexesandsys.index_columns, not only that the migration applied. It also inserts rows to check what a unique index refuses (SQL Server: a unique complex index over nullable columns admits only one row without a value #88). - Seeds: prove the lane catches the three defects above, reverted one at a time.
Done when
The SQL Server lane runs on every PR as Integration (SQL Server 2022), and reverting #84's, #88's or #90's fix makes it fail (#120). Moving the lane into its own test project, and requiring it through the CI gate (#110) instead of a required check of its own, moved to CaffeinatedCoder/CodoMetis.EFCore.SchemaKit#12 on 2026-10-20, with the rest of the lane restructuring.
Activity
test: a SQL Server integration lane that applies migrations to a live…
test: shrink the columns in the lane's ALTER COLUMN test, which widen…
test: a SQL Server integration lane that applies migrations to a live…
test: shrink the columns in the lane's ALTER COLUMN test, which widen…