Support non-key filtered indexes, fluent fallback modes and metadata round-trips - #200
Open
jogibear9988 wants to merge 1 commit into
Open
jogibear9988 wants to merge 1 commit into
jogibear9988 wants to merge 1 commit into
Conversation
…round-trips Fixes #199: allow SQL Server, PostgreSQL and SQLite filter predicates to reference table columns outside the index keys. Render null and DBNull comparisons as IS NULL/IS NOT NULL and escape string filter literals. Add UnsupportedIndexFilterBehavior.Throw (default) and Ignore to Index, with OnUnsupportedFilter(...) in the fluent builder. Unsupported providers can explicitly create an unfiltered index; supported filters remain active and other invalid options or database errors are not suppressed. Honor the policy for SQL Server 2005 and Oracle's limited expression emulation too. Share predicate formatting and catalog parsing across native filtered-index providers. Preserve null checks, quoted identifiers, escaped strings and conjunctions when reading index definitions. Keep included columns before WHERE in PostgreSQL, preserve key order and scope metadata to the requested table. Match SQLite index definitions by exact index name and preserve the filter across table rebuilds. Carry the fallback policy and metadata through fluent snapshots, including definitions with null included-column arrays. Add regression coverage for the reported unique-index example, unsupported provider modes, classic/fluent round-trips, catalog metadata, SQLite rebuilds and reuse of read-back definitions. Update the generated manual and runner guide, documenting unfiltered uniqueness, preview and Oracle limitations. Validation after rebasing onto current master: - Solution build succeeded. - Unit suite: 799 passed; SQLite suite: 421 passed. - Final filtered-index/fluent checks: 59 passed. - Documentation generation, consistency and link/sample-structure checks passed. - Live SQL Server/PostgreSQL round-trip tests added for CI; servers unavailable locally.
This branch has not been deployed
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.
Fixes #199.
A unique index on
IpaUserIdentifierfiltered byIpaUserIdentifier IS NOT NULL AND Archive = 0previously failed because shared validation required every filter column to be an index key, and null filter values were unsupported. SQL Server, PostgreSQL and SQLite now support this definition through both the classic and fluent APIs, and can read back the supported index definition for recreation.Changes
DBNull.Valuecomparisons asIS NULLorIS NOT NULL.Index.UnsupportedFilterBehaviorwithUnsupportedIndexFilterBehavior.Throw(default) andIgnore, exposed through fluent.OnUnsupportedFilter(...).AND.INCLUDEbeforeWHERE.Usage
Read back with
Database.GetIndexes("Users")orSchema.Table("Users").Indexes()in fluent migrations.Behavior and limits
Ignore creates an unfiltered index. For a unique index, uniqueness then applies to all rows. The fallback policy is an authoring option and is not stored in database metadata.
Oracle retains its limited non-unique, key-column expression emulation; expression read-back as
FilterItemsremains unsupported. SQL preview still rejects filtered indexes, including Ignore mode. Predicates that cannot be represented byFilterItems, such asOR, fail explicitly.Validation
Rebased onto current
masterand verified:dotnet build Migrator.slnx --no-restore -v quiet: passed.