Repository navigation
The core differ refuses NULLS ordering and expression parts on SQL Server and PostgreSQL (#172) - #175
Merged
Conversation
…QL Server and PostgreSQL (#172) #134 refused these parts only on providers no satellite serves. Under UseComplexIndexes(), or without a satellite's .targets, the core differ runs on SQL Server and PostgreSQL too, and it scaffolded such an index with the runtime-wiring sentinel: the migration failed at apply naming UseNpgsqlComplexIndexes(), on SQL Server as well, while the packed core README said migrations add fails. ValidateRenderableParts now returns early only for a satellite's own differ. On PostgreSQL the message names the satellite's registration; on SQL Server it says neither differ renders the part, as the SQL Server satellite already refuses it. The three MigrationModelDifferTests that drove the core differ on PostgreSQL to exercise parts plumbing now go through the Npgsql differ, which inherits it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e core differ (#172) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Owner
Author
|
Proof with the fix reverted (throwaway
|
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 #172
Problem
The packed core README says that on SQL Server, an index with
DbOrder.NullsFirst/NullsLast"makesdotnet ef migrations addfail". That holds only when the SQL Server satellite's differ runs. #134'sValidateRenderablePartsreturned early on any provider that has a satellite. The core differ runs on SQL Server too: when a consumer installs only the core package, underUseComplexIndexes()in place ofUseSqlServerComplexIndexes(), or without the satellite's.targets. There it scaffolded:CREATE INDEX [ix_commits_reviewed] ON [NCommit] ([Created], [ReviewedAt], [__requires_UseNpgsqlComplexIndexes__]);That statement fails at apply, naming
UseNpgsqlComplexIndexes()to a SQL Server consumer. Expression parts behave the same way, and so does the core differ on PostgreSQL.Change
CustomMigrationsModelDiffer.ValidateRenderablePartsnow returns early only when a satellite's own differ is running (_satellite is not null && IsSatelliteDiffer). The message depends on the provider:UseNpgsqlComplexIndexes(), or reference the package so its.targetsselects its differ).ValidateCreateIndexOperationis unchanged and still refuses both parts, asdocs/sqlserver.mdsays.Satellite.RendersIndexPartsselects between the two satellite messages.### Changed answersrow is extended ("…and under the core differ on SQL Server and PostgreSQL") and links Core differ on SQL Server scaffolds a NULLS-ordered or expression index that fails at apply; the core README says migrations add fails #172 too. There is no new row: what this adds is a loud failure that moves earlier, and no answer changes silently.docs/upgrading.md: a paragraph in SQLite: a NULLS-ordered complex index scaffolds the PostgreSQL sentinel, and applies without its ordering where SQLite accepts double-quoted strings #134's entry. One 5.4.1 setup did apply such an index, and correctly:UseNpgsqlComplexIndexes().UseComplexIndexes(), which runs the core differ with the PostgreSQL generator (checked: the context resolvesCustomMigrationsModelDifferandNpgsqlComplexIndexSqlGenerator). That setup now fails inEnsureCreated(),GenerateCreateScript()andMigrate(), as it already does under UseComplexIndexes() on PostgreSQL or SQL Server still drops exclusion and temporal constraints and the IS NOT NULL filter without a word #150 for options and constraints. The entry says so and names the fix.MigrationModelDifferTests: three tests drove the core differ on PostgreSQL to exercise the parts plumbing. That is exactly the path now refused, so they now go through the Npgsql differ, which inherits the plumbing; their assertions are unchanged.Labels follow the issue. Not
breaking: the only setup that newly fails is the double registration above, which #150 already refuses for any satellite option or constraint.Tests
CoreDifferIndexPartsTests, ten cases:UseNpgsqlComplexIndexes.UseNpgsqlComplexIndexes()."ReviewedAt" NULLS LASTand(lower("Title")).if (_satellite is not null)): the four refusal cases fail and the six controls pass.SqlServerIntegrationTests.Core_registration_refuses_a_nulls_ordered_index: underUseComplexIndexes(),EnsureCreated()throwsInvalidOperationExceptionandcarsdoesn't exist, so the refusal came before any DDL. It runs only in CI. The proof run with the fix reverted, on the throwawayproof/169-172-revertbranch, is reported below.TestCategory!=Integration).🤖 Generated with Claude Code