Repository navigation
SQLite: refuse NULLS-ordered and expression parts the core cannot render (#134) - #140
Merged
Merged
Conversation
… satellite (#134) Only the PostgreSQL satellite's generator renders the parts annotation. On SQLite the index carried the Npgsql sentinel column, which fails only while double-quoted string literals are off: with them on, the sentinel and a quoted expression were taken for strings and the index applied with a constant column. The core differ now refuses such a declaration in the target model when no satellite serves the provider; a snapshot holding one stays diffable. 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 #134
Problem
On SQLite, which no satellite serves, a complex index with a
DbOrder.NullsFirst/NullsLastpart or an expression part was diffed by the core differ. That routes the index through theIndexPartsannotation and appends the Npgsql sentinel (__requires_UseNpgsqlComplexIndexes__) toColumns. Only the PostgreSQL satellite's generator reads that annotation. On SQLite the sentinel was supposed to make the apply fail, but that held only with SQLite's double-quoted string literals off, as in thee_sqlite3build Microsoft.Data.Sqlite bundles. With them on (SQLITE_DBCONFIG_DQS_DDL, the default in a stock SQLite build), the sentinel and a quoted expression are read as string literals, and the index applies with a constant column, without its ordering or expression:The expression case was not in the issue. The fix's own revert run showed it:
HasExpressionIndex, in a model shared with SQLite tests, applies silently the same way.Change
CustomMigrationsModelDiffer.ValidateRenderableParts: runs on the target model only, when no satellite serves the provider. It refuses any index whose parts need the annotation, naming the index, the table and the provider, with the same remedies the SQL Server satellite gives. The source model is not checked, so a snapshot holding such an index stays diffable: removing the marker drops the index and creates it from its columns.MigrationModelDifferTestschecked the core differ's parts handling (NULLS ordering, expression parts) on SQLite. They now run the core differ over PostgreSQL, where those parts remain valid.### Changed answers, in the Indexes area, in both the root and core changelogs.docs/upgrading.md, saying how to find and fix an index that already applied this way. The core README and CLAUDE.md are updated too.Tests
SqliteNullOrderingTestsruns on real in-memory SQLite withSQLITE_DBCONFIG_DQS_DDLon:sqlite_master.With
ValidateRenderablePartsreverted, the three refusal tests fail with "no exception was thrown": the migration applies silently. The snapshot test passes either way, on purpose. It guards against extending the check to the source model, which would make an affected snapshot impossible to diff.The unit suite passes: 562 tests (
TestCategory!=Integration&TestCategory!=SqlServer).🤖 Generated with Claude Code