Repository navigation
Tests: a SQL Server integration lane that applies migrations to a live server - #120
Merged
Merged
Conversation
… server (#100) Nothing applied a SQL Server migration to a SQL Server: every SQL Server test compared rendered SQL or the operation list, and #84, #88 and #90 each passed all of them while failing only on a server. SqlServerIntegrationTests (TestCategory Integration and SqlServer) starts mcr.microsoft.com/mssql/server:2022-latest through Testcontainers.MsSql, creates a database per test, diffs with the SQL Server differ as migrations add does and applies as database update does: the context's runtime generator (UseSqlServerComplexIndexes()) renders with the target model and EF's command executor runs it. It reads the result back from sys.indexes, sys.index_columns and sys.partitions, and inserts rows to see what unique indexes refuse. Covered: every whitelisted option property- and entity-level, a DESC part, a placeholder filter, a unique index over an optional complex property (#88), an index rename, a table rename, ALTER COLUMN under a key and under an included column (#84), the clustered cases and the key-name refusal of #90, and EnsureCreated. CI: a job "Integration (SQL Server 2022)" beside the PostgreSQL one, with CI=true; the PostgreSQL job now excludes TestCategory=SqlServer, and Pack waits for both. Locally without a usable image the class goes inconclusive; on Apple Silicon the amd64 image needs Rosetta (it crashes under QEMU), noted in CLAUDE.md. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ing cannot fail (#100) SQL Server allows widening an nvarchar under an index as a metadata-only change, so the test passed with #84's fix reverted (proof run on a draft branch). Shrinking is refused with Msg 5074, as a type or nullability change is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CaffeinatedCoder
force-pushed
the
tests/100-sqlserver-lane
branch
from
October 20, 2026 06:26
2cc0216 to
318a6f4
Compare
CaffeinatedCoder
force-pushed
the
tests/96-sqlserver-seeds
branch
from
October 20, 2026 06:26
981c13b to
01c1a52
Compare
CaffeinatedCoder
changed the base branch from
tests/96-sqlserver-seeds
to
main
October 20, 2026 06:40
CaffeinatedCoder
added a commit
that referenced
this pull request
Oct 20, 2026
…eSql The SQL Server lane (#120) pinned Testcontainers.MsSql 4.14.0 after this bump was opened, so the two modules would resolve different versions of the shared Testcontainers core. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #100
Stacked on #113 (#96) → #107 (#92) → #105 (#90). Merge in that order. The
.NETworkflow runs only on PRs intomain/release/**, so this branch's CI is aworkflow_dispatchrun on the same commit. Once it targetsmain, the new job reports on the PR itself.The trigger may change. A separate session is analysing selective CI across the repositories, so how and when this job runs may change after that analysis. The shape here is deliberately the plainest one: the same triggers and steps as
Integration (PostgreSQL 18).Problem
Nothing applied a SQL Server migration to a SQL Server. Every SQL Server test compared rendered SQL or the operation list, and that layer cannot see what the server refuses or accepts. Three 5.5.0 defects passed all of them:
ALTER COLUMNunder a complex index failed with Msg 5074.model: null(Tests: seeded defects in the core and SQL Server differs that the suite does not catch, and the model-less SQL Server rendering #96).Change
SqlServerIntegrationTests(TestCategoryIntegrationandSqlServer):Testcontainers.MsSql4.14.0 (same version as the PostgreSQL package) startsmcr.microsoft.com/mssql/server:2022-latest, with a database per test.migrations adddoes, and applies asdatabase updatedoes. The context's runtime services (UseSqlServerComplexIndexes()) render with the target model, and EF'sIMigrationCommandExecutorruns the commands.sys.indexes,sys.index_columnsandsys.partitionsgive type, uniqueness, filter, fill factor, compression, key order and direction, and included columns. It inserts rows to check what unique indexes refuse.ONLINEandSORT_IN_TEMPDBare not stored, so their proof is that the statement applied)ALTER COLUMNshrinking a key column and an included column (SQL Server: ALTER COLUMN on a column under a complex index fails at apply (Msg 5074) #84)EnsureCreated()with the satellite's registrationIntegration (SQL Server 2022)indotnet.ymlbeside the PostgreSQL one, withCI=true, so an unavailable container fails instead of going inconclusive. The PostgreSQL job now filtersTestCategory!=SqlServer, andPackwaits for both.release.ymlruns the full suite withCI=true, so the lane gates releases too.CLAUDE.mdandCONTRIBUTING.mdname the second lane.CLAUDE.mdadds the local caveat: the image is amd64 only and crashes under QEMU on Apple Silicon, so it needs Rosetta in the Docker VM (orb config set rosetta trueon OrbStack).Tests
Local: this Mac runs OrbStack with Rosetta off, and SQL Server 2022 crashes under QEMU there, so the class goes inconclusive locally as designed. The lane was verified on CI only.
Lane green: a dispatch run on this branch executed all 11 tests and passed them (trx counters:
total=11 executed=11 passed=11).Proof by revert, each a throwaway commit on a branch of its own (
proof/100-revert-*, nevermain), with the workflow dispatched there:RequiresIndexRecreation→false)ALTER COLUMN under a complex index applies: "The index 'ux_phone' is dependent on column 'phone'. ALTER TABLE ALTER COLUMN phone failed…"ImplicitFilter→null)nullwhere([Registration_Vin] IS NOT NULL)was expectedSqlExceptioninstead of amigrations addrefusal: "Cannot create more than one clustered index on table 'customers'" and "…an index or statistics with name 'pk_customers' already exists"The first #84 proof passed 11/11. The test widened the columns, and SQL Server allows widening an
nvarcharunder an index as a metadata-only change. It now shrinks them, and the proof above is the rerun.Finding: a probe on another throwaway branch showed that index names differing only in case pass the name checks and fail at apply on SQL Server. Filed as #116.
Required check
Branch protection is unchanged. After this merges, add the job as a required check:
gh api -X POST repos/CaffeinatedCoder/EFCore.ComplexIndexes/branches/main/protection/required_status_checks/contexts -f 'contexts[]=Integration (SQL Server 2022)'The same for
release/5.xonce it is cut, withmainreplaced byrelease/5.xin the path.🤖 Generated with Claude Code