You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SQLite: re-create complex indexes after a table rebuild instead of refusing the migration #95
area/indexesComplex-property, composite, unique and filtered indexesarea/migrationsThe differs, snapshot format, EnsureCreated and design-time wiringenhancementNew feature or requestpackage/coreAffects EFCore.ComplexIndexes
#86 makes migrations add refuse, on SQLite, a migration whose table rebuild would drop a complex index, and points the consumer to a three-migration split. That is honest but costly: a table rename or an ALTER COLUMN on a table with a complex index now takes three migrations.
The real fix needs a step after EF Core's rewrite: SqliteMigrationsSqlGenerator.RewriteOperations emits every rebuild after all other operations, so nothing the differ emits can run after it.
Proposal
UseComplexIndexes() on SQLite also wraps the provider's IMigrationsSqlGenerator: it generates the inner commands, then appends the CREATE INDEX of every complex index on each rebuilt table.
The differ marks those creates (an annotation) and ANDs a call to __requires_UseComplexIndexes__() onto their filter, so a missing registration fails loudly at apply time instead of losing the index. Not the column sentinel: SQLite with double-quoted string literals on accepts an unknown quoted column as a string. With the wrapper in effect, which the differ asks the context for, the refusal of SQLite: a migration that rebuilds a table silently drops every complex index on it #86 is lifted.
Design questions: decorating a provider service EF registers by type; the design-time path (dotnet ef database update uses the context's runtime services, so the registration must be in the context); idempotent scripts.
Ships in 5.5.0 (epic #36), as a changed answer: the refusal becomes a migration. Design and measurements: #138.
area/indexesComplex-property, composite, unique and filtered indexesarea/migrationsThe differs, snapshot format, EnsureCreated and design-time wiringenhancementNew feature or requestpackage/coreAffects EFCore.ComplexIndexes
Activity
Merge pull request #138 from CaffeinatedCoder/feat/95-sqlite-rebuild-…
Pin three 5.5.0 behaviours the pre-tag seeds survived