EF Core sweep follow-ups: sequences, check constraints, computed columns, index methods, drift detection, Oracle/MySql parity - #372
Merged
Conversation
…d columns, index methods, drift detection, Oracle/MySql parity Follow-ups to the EF Core schema-parity sweep (#361): - Sequences: SequenceBase.IncrementBy (HiLo block size), Migrator.CreateSequence seam (PG/SS/Oracle), GetSchemaObjectsForMigration maps model sequences (UseHiLo/UseSequence/HasSequence) ahead of tables; CreateMigrationAsync uses it - Check constraints: TableCheckConstraint in Weasel.Core, ITable.AddCheckConstraint, CREATE emission + catalog reads + conservative delta comparison on PG and SS (only declared checks compared; unknown constraints never dropped) - Computed columns: ITableColumn.ComputedExpression/ComputedColumnIsStored with emission on PG (STORED), SS (AS ... PERSISTED), MySQL, SQLite (mapped onto its existing generated-column model); Oracle throws rather than emitting wrong DDL - Index methods: ITableIndex.Method maps Npgsql HasMethod("gin") automatically - Opt-in column drift detection: ITable.DetectColumnDrift compares canonicalized defaults + nullability of matching columns and emits ALTER corrections on PG/SS; off by default (datetime literal canonicalization is not stable enough to be safe) - Oracle casing parity: preserve-case columns/PK/FK are quoted (folded convention unchanged), covered by DB-free DDL tests - MySQL: EF CI service added, EnsureDeleted hazard removed from its e2e tests - SQL Server FetchExisting reads column defaults/nullability; ItemDelta matching case-insensitive; EF docs updated (casing, sequences, drift, owned types) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Follow-up round to #361, working through the remaining gaps the schema-parity sweep documented.
What's here
SequenceBase.IncrementBy(HiLo's block size is load-bearing), aMigrator.CreateSequenceseam (PG / SQL Server / Oracle; MySQL & SQLite return null), andGetSchemaObjectsForMigrationmapping model sequences (UseHiLo,UseSequence,HasSequence) ahead of the tables.CreateMigrationAsyncnow includes them. SQL Server'sUseSequenceNEXT VALUE FORdefaults flow through and match.TableCheckConstraint+ITable.AddCheckConstraint, CREATE TABLE emission, catalog reads, and delta comparison on PostgreSQL and SQL Server. Deliberately conservative: only constraints the model declares are compared, and constraints Weasel doesn't know about (inline column checks, third-party) are never dropped.ITableColumn.ComputedExpression/ComputedColumnIsStored, emitted on PG (GENERATED ALWAYS AS ... STORED), SQL Server (AS (...) [PERSISTED]), MySQL, and SQLite (mapped onto its existing generated-column model). Oracle throws rather than silently emitting a plain column.ITableIndex.Method; NpgsqlHasMethod("gin")now maps automatically (no more escape hatch for gin).ITable.DetectColumnDrift: default-expression + nullability comparison for otherwise-matching columns withALTER COLUMNcorrections on PG and SQL Server (incl. dropping SQL Server's server-named default constraints). Off by default — datetime literal canonicalization isn't stable enough to make it safe blanket-on, and a false positive means perpetual re-apply. Direct provider tests cover changed/dropped defaults and nullability drift round-trips.PreserveIdentifierCase(folded convention byte-identical), covered by DB-free DDL tests (live verification rides on ci-build-oracle; the arm64 local container won't boot).EnsureDeletedhazard removed from its e2e tests. Verified locally against mysql:8.0.FetchExistingnow reads column defaults/nullability, SSItemDeltamatching is case-insensitive, and the EF docs (docs/efcore/table-mapping.md) are updated for casing/sequences/owned types/drift.Verification
🤖 Generated with Claude Code