Skip to content

Conversation

@roji
Copy link
Member

@roji roji commented Feb 9, 2026

Closes #11488

@roji roji force-pushed the FullTextMigrations branch 2 times, most recently from 8243e26 to b5ed266 Compare February 9, 2026 10:05
@roji roji marked this pull request as ready for review February 9, 2026 11:16
@roji roji requested a review from a team as a code owner February 9, 2026 11:16
Copilot AI review requested due to automatic review settings February 9, 2026 11:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds end-to-end SQL Server full-text search (FTS) metadata support to EF Core’s SQL Server provider, enabling configuration, scaffolding, and migration SQL generation for full-text catalogs and full-text indexes (including options like key index, catalog, change tracking, and per-column languages).

Changes:

  • Introduces new full-text catalog metadata APIs (interfaces + builder) and full-text index builder APIs.
  • Extends migrations/scaffolding/design-time code generation to persist and round-trip full-text catalogs and indexes.
  • Adds functional/unit test coverage across model validation, annotation codegen, migrations, scaffolding, and compiled model behavior.

Reviewed changes

Copilot reviewed 37 out of 38 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs Adds model validation tests for full-text index rules (duplicates, missing key index, invalid column types).
test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs Verifies design-time fluent API generation for full-text index/catalog annotations.
test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerDatabaseCleaner.cs Ensures test DB cleanup drops full-text catalogs.
test/EFCore.SqlServer.FunctionalTests/SqlServerApiConsistencyTest.cs Registers new full-text catalog builder and metadata interfaces for API consistency testing.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/SqlServerDatabaseModelFactoryTest.cs Adds scaffolding tests for full-text catalogs and indexes.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/CompiledModelSqlServerTest.cs Adds compiled-model test ensuring full-text annotations aren’t emitted at runtime.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Full_text_index/FullTextEntityUnsafeAccessors.cs Adds compiled-model scaffolding baseline for full-text index scenario.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Full_text_index/FullTextEntityEntityType.cs Adds compiled-model scaffolding baseline entity-type metadata for full-text index scenario.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Full_text_index/DbContextModelBuilder.cs Adds compiled-model scaffolding baseline model builder output for full-text index scenario.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Full_text_index/DbContextModel.cs Adds compiled-model scaffolding baseline runtime model for full-text index scenario.
test/EFCore.SqlServer.FunctionalTests/Scaffolding/Baselines/Full_text_index/DbContextAssemblyAttributes.cs Adds compiled-model scaffolding baseline assembly attributes for full-text index scenario.
test/EFCore.SqlServer.FunctionalTests/ModelBuilding/SqlServerTestModelBuilderExtensions.cs Extends test model-builder abstraction to support full-text index/catalog configuration.
test/EFCore.SqlServer.FunctionalTests/ModelBuilding/SqlServerModelBuilderTestBase.cs Adds model-building tests for full-text index/catalog fluent API configuration.
test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs Adds migration tests for create/drop/alter full-text catalogs and create/drop full-text indexes + options.
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs Scaffolds full-text catalogs and full-text indexes from SQL Server system catalogs.
src/EFCore.SqlServer/Properties/SqlServerStrings.resx Adds new model validation error messages for full-text configuration.
src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs Adds strongly-typed accessors for new full-text validation messages.
src/EFCore.SqlServer/Migrations/SqlServerMigrationsSqlGenerator.cs Generates SQL for creating/dropping full-text indexes and for create/drop/alter full-text catalogs.
src/EFCore.SqlServer/Migrations/Internal/SqlServerMigrationsAnnotationProvider.cs Ensures drop operations carry full-text annotations so correct DROP FULLTEXT INDEX SQL is generated.
src/EFCore.SqlServer/Metadata/Internal/SqlServerFullTextCatalog.cs Adds internal catalog metadata implementation stored in model annotations.
src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationProvider.cs Flows full-text catalog and index annotations into design-time annotations.
src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationNames.cs Adds annotation names for full-text index/catalog options.
src/EFCore.SqlServer/Metadata/ISqlServerFullTextCatalog.cs Adds public metadata interface for full-text catalogs (runtime model view).
src/EFCore.SqlServer/Metadata/IReadOnlySqlServerFullTextCatalog.cs Adds public read-only metadata interface for full-text catalogs.
src/EFCore.SqlServer/Metadata/IMutableSqlServerFullTextCatalog.cs Adds public mutable metadata interface for full-text catalogs.
src/EFCore.SqlServer/Metadata/IConventionSqlServerFullTextCatalog.cs Adds public convention metadata interface for full-text catalogs.
src/EFCore.SqlServer/Metadata/Builders/SqlServerFullTextIndexBuilder`1.cs Adds generic full-text index builder API surface.
src/EFCore.SqlServer/Metadata/Builders/SqlServerFullTextIndexBuilder.cs Adds non-generic full-text index builder API surface.
src/EFCore.SqlServer/Metadata/Builders/SqlServerFullTextCatalogBuilder.cs Adds full-text catalog builder API surface.
src/EFCore.SqlServer/Infrastructure/Internal/SqlServerModelValidator.cs Adds model validation for full-text index constraints (single per table, key index required, column-type checks).
src/EFCore.SqlServer/FullTextChangeTracking.cs Adds enum representing SQL Server full-text change tracking modes.
src/EFCore.SqlServer/Extensions/SqlServerModelExtensions.cs Adds model-level extension methods to add/find/remove/enumerate full-text catalogs.
src/EFCore.SqlServer/Extensions/SqlServerModelBuilderExtensions.cs Adds HasFullTextCatalog fluent API on ModelBuilder.
src/EFCore.SqlServer/Extensions/SqlServerIndexExtensions.cs Adds index-level extension methods for full-text index annotations (key index, catalog, change tracking, languages).
src/EFCore.SqlServer/Extensions/SqlServerIndexBuilderExtensions.cs Adds fluent API extensions for full-text index options on IndexBuilder.
src/EFCore.SqlServer/Extensions/SqlServerEntityTypeBuilderExtensions.cs Adds HasFullTextIndex fluent API on EntityTypeBuilder (generic and non-generic).
src/EFCore.SqlServer/Design/Internal/SqlServerCSharpRuntimeAnnotationCodeGenerator.cs Prevents full-text annotations from being serialized into runtime/compiled models.
src/EFCore.SqlServer/Design/Internal/SqlServerAnnotationCodeGenerator.cs Adds design-time fluent API generation for full-text catalogs and full-text index options.
Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Language not supported

Copilot AI review requested due to automatic review settings February 9, 2026 11:27
@roji roji force-pushed the FullTextMigrations branch from ab4af11 to 60109d6 Compare February 9, 2026 11:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 38 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Language not supported

@roji roji force-pushed the FullTextMigrations branch from 60109d6 to 45e68d5 Compare February 9, 2026 12:45
Comment on lines 58 to 60
// FullTextCatalogs is placed on the relational model by the annotation provider,
// but is also available on IModel - remove it to avoid serialization issues.
parameters.Annotations.Remove(SqlServerAnnotationNames.FullTextCatalogs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is FullTextCatalogs placed on the relational model by the annotation provider?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot says:

FullTextCatalogs are placed on the relational model so that the MigrationsModelDiffer can detect
catalog changes and generate AlterDatabaseOperation.

Is this incorrect? If so let me know how you want it.

Copilot AI review requested due to automatic review settings February 11, 2026 10:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 38 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Language not supported

var isDefault = reader.GetFieldValue<bool>("is_default");
var isAccentSensitive = reader.GetFieldValue<bool>("is_accent_sensitivity_on");

var catalog = new SqlServerFullTextCatalog(name, model: null!, ConfigurationSource.DataAnnotation);
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SqlServerFullTextCatalog is constructed with model: null! during scaffolding. While this currently works because the Model property isn't dereferenced during scaffolding (only used in the IsReadOnly check which safely handles null), this is fragile. If future code attempts to access the Model property directly, it will throw NullReferenceException. Consider using a sentinel pattern or making Model nullable in the constructor.

Copilot uses AI. Check for mistakes.
@roji roji force-pushed the FullTextMigrations branch from 3583f0a to bb2baf5 Compare February 11, 2026 11:12
@roji roji requested a review from AndriySvyryd February 11, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL Server full-text search: Support creating full-text indexes and catalogs in migrations

2 participants