diff --git a/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs b/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs index d11a08d6a..40d5f17df 100644 --- a/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs +++ b/src/EFCore.PG/Design/Internal/NpgsqlAnnotationCodeGenerator.cs @@ -105,10 +105,6 @@ private static readonly MethodInfo IndexHasOperatorsMethodInfo = typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod( nameof(NpgsqlIndexBuilderExtensions.HasOperators), typeof(IndexBuilder), typeof(string[])); - private static readonly MethodInfo IndexHasSortOrderMethodInfo - = typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod( - nameof(NpgsqlIndexBuilderExtensions.HasSortOrder), typeof(IndexBuilder), typeof(SortOrder[])); - private static readonly MethodInfo IndexHasNullSortOrderMethodInfo = typeof(NpgsqlIndexBuilderExtensions).GetRequiredRuntimeMethod( nameof(NpgsqlIndexBuilderExtensions.HasNullSortOrder), typeof(IndexBuilder), typeof(NullSortOrder[])); @@ -423,8 +419,6 @@ public override IReadOnlyList GenerateFluentApiCalls( => new MethodCallCodeFragment(IndexHasMethodMethodInfo, annotation.Value), NpgsqlAnnotationNames.IndexOperators => new MethodCallCodeFragment(IndexHasOperatorsMethodInfo, annotation.Value), - NpgsqlAnnotationNames.IndexSortOrder - => new MethodCallCodeFragment(IndexHasSortOrderMethodInfo, annotation.Value), NpgsqlAnnotationNames.IndexNullSortOrder => new MethodCallCodeFragment(IndexHasNullSortOrderMethodInfo, annotation.Value), NpgsqlAnnotationNames.IndexInclude diff --git a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlEntityTypeBuilderExtensions.cs b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlEntityTypeBuilderExtensions.cs index 0d78f939f..52d134bf4 100644 --- a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlEntityTypeBuilderExtensions.cs +++ b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlEntityTypeBuilderExtensions.cs @@ -294,45 +294,4 @@ public static EntityTypeBuilder UseCockroachDbInterleaveInParent - /// Configures using the auto-updating system column xmin as the optimistic concurrency token. - /// - /// The builder for the entity type being configured. - /// The same builder instance so that multiple calls can be chained. - /// - /// See Concurrency tokens - /// for more information on using optimistic concurrency in PostgreSQL. - /// - [Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")] - public static EntityTypeBuilder UseXminAsConcurrencyToken( - this EntityTypeBuilder entityTypeBuilder) - { - Check.NotNull(entityTypeBuilder, nameof(entityTypeBuilder)); - - entityTypeBuilder.Property("xmin") - .HasColumnType("xid") - .ValueGeneratedOnAddOrUpdate() - .IsConcurrencyToken(); - - return entityTypeBuilder; - } - - /// - /// Configures using the auto-updating system column xmin as the optimistic concurrency token. - /// - /// - /// See http://www.npgsql.org/efcore/miscellaneous.html#optimistic-concurrency-and-concurrency-tokens - /// - /// The builder for the entity type being configured. - /// The same builder instance so that multiple calls can be chained. - [Obsolete("Use EF Core's standard IsRowVersion() or [Timestamp], see https://learn.microsoft.com/ef/core/saving/concurrency")] - public static EntityTypeBuilder UseXminAsConcurrencyToken( - this EntityTypeBuilder entityTypeBuilder) - where TEntity : class - => (EntityTypeBuilder)UseXminAsConcurrencyToken((EntityTypeBuilder)entityTypeBuilder); - - #endregion Obsolete } diff --git a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlIndexBuilderExtensions.cs b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlIndexBuilderExtensions.cs index cbe0ea1fa..741bff72a 100644 --- a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlIndexBuilderExtensions.cs +++ b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlIndexBuilderExtensions.cs @@ -847,281 +847,4 @@ public static bool CanSetStorageParameter( } #endregion Storage parameters - - #region Sort order (legacy) - - /// - /// The PostgreSQL index sort ordering to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// The sort order to use for each column. - /// A builder to further configure the index. - [Obsolete("Use IsDescending instead")] - public static IndexBuilder HasSortOrder( - this IndexBuilder indexBuilder, - params SortOrder[]? values) - { - Check.NotNull(indexBuilder, nameof(indexBuilder)); - Check.NullButNotEmpty(values, nameof(values)); - - var isDescending = new bool[indexBuilder.Metadata.Properties.Count]; - - for (var i = 0; i < isDescending.Length; i++) - { - isDescending[i] = values?.Length > i && values[i] == SortOrder.Descending; - } - - indexBuilder.IsDescending(isDescending); - - return indexBuilder; - } - - /// - /// The PostgreSQL index sort ordering to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// The sort order to use for each column. - /// A builder to further configure the index. - [Obsolete("Use IsDescending instead")] - public static IndexBuilder HasSortOrder( - this IndexBuilder indexBuilder, - params SortOrder[]? values) - => (IndexBuilder)HasSortOrder((IndexBuilder)indexBuilder, values); - - /// - /// The PostgreSQL index sort ordering to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// Indicates whether the configuration was specified using a data annotation. - /// The sort order to use for each column. - /// A builder to further configure the index. - [Obsolete("Use IsDescending instead")] - public static IConventionIndexBuilder? HasSortOrder( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - { - if (indexBuilder.CanSetSortOrder(values, fromDataAnnotation)) - { - Check.NotNull(indexBuilder, nameof(indexBuilder)); - Check.NullButNotEmpty(values, nameof(values)); - - var isDescending = new bool[indexBuilder.Metadata.Properties.Count]; - - for (var i = 0; i < isDescending.Length; i++) - { - isDescending[i] = values?.Count > i && values[i] == SortOrder.Descending; - } - - indexBuilder.IsDescending(isDescending); - - return indexBuilder; - } - - return null; - } - - /// - /// Returns a value indicating whether the PostgreSQL index sort ordering can be set. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// The sort order to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the index. - [Obsolete("Use IsDescending instead")] - public static bool CanSetSortOrder( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - { - Check.NotNull(indexBuilder, nameof(indexBuilder)); - - return indexBuilder.CanSetAnnotation(NpgsqlAnnotationNames.IndexSortOrder, values, fromDataAnnotation); - } - - #endregion Sort order (obsolete) - - #region Obsolete - - /// - /// The PostgreSQL index collation to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-collations.html - /// - /// The builder for the index being configured. - /// The sort options to use for each column. - /// A builder to further configure the index. - [Obsolete("Use UseCollation")] - public static IndexBuilder HasCollation( - this IndexBuilder indexBuilder, - params string[]? values) - => UseCollation(indexBuilder, values); - - /// - /// The PostgreSQL index collation to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-collations.html - /// - /// The builder for the index being configured. - /// The sort options to use for each column. - /// A builder to further configure the index. - [Obsolete("Use UseCollation")] - public static IndexBuilder HasCollation( - this IndexBuilder indexBuilder, - params string[]? values) - => UseCollation(indexBuilder, values); - - /// - /// The PostgreSQL index collation to be used. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-collations.html - /// - /// The builder for the index being configured. - /// The sort options to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the index. - [Obsolete("Use UseCollation")] - public static IConventionIndexBuilder? HasCollation( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - => UseCollation(indexBuilder, values, fromDataAnnotation); - - /// - /// Returns a value indicating whether the PostgreSQL index collation can be set. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-collations.html - /// - /// The builder for the index being configured. - /// The sort options to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the index. - [Obsolete("Use CanSetHasCollation")] - public static bool CanSetHasCollation( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - => CanSetCollation(indexBuilder, values, fromDataAnnotation); - - /// - /// The PostgreSQL index method to be used. Null selects the default (currently btree). - /// - /// - /// http://www.postgresql.org/docs/current/static/sql-createindex.html - /// - /// The builder for the index being configured. - /// The name of the index. - /// Indicates whether the configuration was specified using a data annotation. - /// true if the index can be configured with the method - [Obsolete("Use CanSetMethod")] - public static bool CanSetHasMethod( - this IConventionIndexBuilder indexBuilder, - string? method, - bool fromDataAnnotation = false) - => CanSetMethod(indexBuilder, method, fromDataAnnotation); - - /// - /// Returns a value indicating whether the PostgreSQL index operators can be set. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-opclass.html - /// - /// The builder for the index being configured. - /// The operators to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// true if the index can be configured with the method. - [Obsolete("Use CanSetOperators")] - public static bool CanSetHasOperators( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? operators, - bool fromDataAnnotation) - => CanSetOperators(indexBuilder, operators, fromDataAnnotation); - - /// - /// Returns a value indicating whether the index can be configured as a full-text tsvector expression index. - /// - /// The builder for the index being configured. - /// - /// - /// The text search configuration for this generated tsvector property, or null if this is not a - /// generated tsvector property. - /// - /// - /// See https://www.postgresql.org/docs/current/textsearch-controls.html for more information. - /// - /// - /// Indicates whether the configuration was specified using a data annotation. - /// true if the index can be configured as a full-text tsvector expression index. - [Obsolete("Use CanSetIsTsVectorExpressionIndex")] - public static bool CanSetToTsVector( - this IConventionIndexBuilder indexBuilder, - string? config, - bool fromDataAnnotation = false) - => CanSetIsTsVectorExpressionIndex(indexBuilder, config, fromDataAnnotation); - - /// - /// Returns a value indicating whether the PostgreSQL index sort ordering can be set. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// The sort order to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the index. - [Obsolete("Use CanSetSortOrder")] - public static bool CanSetHasSortOrder( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - => CanSetSortOrder(indexBuilder, values, fromDataAnnotation); - - /// - /// Returns a value indicating whether the PostgreSQL index null sort ordering can be set. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - /// The builder for the index being configured. - /// The sort order to use for each column. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the index. - [Obsolete("Use CanSetNullSortOrder")] - public static bool CanSetHasNullSortOrder( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? values, - bool fromDataAnnotation) - => CanSetNullSortOrder(indexBuilder, values, fromDataAnnotation); - - /// - /// Returns a value indicating whether the given include properties can be set. - /// - /// The builder for the index being configured. - /// An array of property names to be used in 'include' clause. - /// Indicates whether the configuration was specified using a data annotation. - /// true if the given include properties can be set. - [Obsolete("Use CanSetIncludeProperties")] - public static bool CanSetInclude( - this IConventionIndexBuilder indexBuilder, - IReadOnlyList? propertyNames, - bool fromDataAnnotation = false) - => CanSetIncludeProperties(indexBuilder, propertyNames, fromDataAnnotation); - - #endregion Obsolete } diff --git a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlModelBuilderExtensions.cs b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlModelBuilderExtensions.cs index f38fda9af..6650eb824 100644 --- a/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlModelBuilderExtensions.cs +++ b/src/EFCore.PG/Extensions/BuilderExtensions/NpgsqlModelBuilderExtensions.cs @@ -768,94 +768,6 @@ public static ModelBuilder HasCollation( #endregion Collation management - #region Default column collation - - /// - /// Configures the default collation for all columns in the database. This causes EF Core to specify an explicit - /// collation when creating each column (unless overridden). - /// - /// - ///

- /// An alternative is to specify a database collation via - /// , - /// which will specify the query on CREATE DATABASE instead of for each and every column. However, - /// PostgreSQL support is limited for the collations that can be specific via this mechanism; ICU collations - - /// which include all case-insensitive collations - are currently unsupported. - ///

- ///

- /// For more information, see https://www.postgresql.org/docs/current/collation.html. - ///

- ///
- /// The model builder. - /// The collation. - /// A builder to further configure the property. - [Obsolete("Use EF Core's standard model bulk configuration API")] - public static ModelBuilder UseDefaultColumnCollation(this ModelBuilder modelBuilder, string? collation) - { - Check.NotNull(modelBuilder, nameof(modelBuilder)); - Check.NullButNotEmpty(collation, nameof(collation)); - - modelBuilder.Model.SetDefaultColumnCollation(collation); - - return modelBuilder; - } - - /// - /// Configures the default collation for all columns in the database. This causes EF Core to specify an explicit - /// collation when creating each column (unless overridden). - /// - /// - ///

- /// An alternative is to specify a database collation via - /// , - /// which will specify the query on CREATE DATABASE instead of for each and every column. However, - /// PostgreSQL support is limited for the collations that can be specific via this mechanism; ICU collations - - /// which include all case-insensitive collations - are currently unsupported. - ///

- ///

- /// For more information, see https://www.postgresql.org/docs/current/collation.html. - ///

- ///
- /// The model builder. - /// The collation. - /// Indicates whether the configuration was specified using a data annotation. - /// A builder to further configure the property. - [Obsolete("Use EF Core's standard model bulk configuration API")] - public static IConventionModelBuilder? UseDefaultColumnCollation( - this IConventionModelBuilder modelBuilder, - string? collation, - bool fromDataAnnotation = false) - { - if (modelBuilder.CanSetDefaultColumnCollation(collation, fromDataAnnotation)) - { - modelBuilder.Metadata.SetDefaultColumnCollation(collation); - return modelBuilder; - } - - return null; - } - - /// - /// Returns a value indicating whether the given value can be set as the default column collation. - /// - /// The model builder. - /// The collation. - /// Indicates whether the configuration was specified using a data annotation. - /// true if the given value can be set as the collation. - [Obsolete("Use EF Core's standard model bulk configuration API")] - public static bool CanSetDefaultColumnCollation( - this IConventionModelBuilder modelBuilder, - string? collation, - bool fromDataAnnotation = false) - { - Check.NotNull(modelBuilder, nameof(modelBuilder)); - - return modelBuilder.CanSetAnnotation( - NpgsqlAnnotationNames.DefaultColumnCollation, collation, fromDataAnnotation); - } - - #endregion Default column collation - #region Helpers // See: https://github.com/npgsql/npgsql/blob/dev/src/Npgsql/TypeMapping/TypeMapperBase.cs#L132-L138 diff --git a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlIndexExtensions.cs b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlIndexExtensions.cs index fe7154f9b..e3e86d6bb 100644 --- a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlIndexExtensions.cs +++ b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlIndexExtensions.cs @@ -479,56 +479,4 @@ public static object SetStorageParameter( } #endregion Storage parameters - - #region Sort order (legacy) - - /// - /// Returns the column sort orders to be used, or null if they have not been specified. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - [Obsolete("Use IsDescending instead")] - public static IReadOnlyList? GetSortOrder(this IReadOnlyIndex index) - => (IReadOnlyList?)index[NpgsqlAnnotationNames.IndexSortOrder]; - - /// - /// Sets the column sort orders to be used, or null if they have not been specified. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - [Obsolete("Use IsDescending instead")] - public static void SetSortOrder(this IMutableIndex index, IReadOnlyList? sortOrder) - => index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexSortOrder, sortOrder); - - /// - /// Sets the column sort orders to be used, or null if they have not been specified. - /// - /// - /// https://www.postgresql.org/docs/current/static/indexes-ordering.html - /// - [Obsolete("Use IsDescending instead")] - public static IReadOnlyList? SetSortOrder( - this IConventionIndex index, - IReadOnlyList? sortOrder, - bool fromDataAnnotation = false) - { - Check.NullButNotEmpty(sortOrder, nameof(sortOrder)); - - index.SetOrRemoveAnnotation(NpgsqlAnnotationNames.IndexSortOrder, sortOrder, fromDataAnnotation); - - return sortOrder; - } - - /// - /// Returns the for the index sort orders. - /// - /// The index. - /// The for the index sort orders. - [Obsolete("Use IsDescending instead")] - public static ConfigurationSource? GetSortOrderConfigurationSource(this IConventionIndex index) - => index.FindAnnotation(NpgsqlAnnotationNames.IndexSortOrder)?.GetConfigurationSource(); - - #endregion Sort order (legacy) } diff --git a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlModelExtensions.cs b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlModelExtensions.cs index 35228a506..a69ccf8ac 100644 --- a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlModelExtensions.cs +++ b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlModelExtensions.cs @@ -516,74 +516,4 @@ public static IReadOnlyList GetCollations(this IReadOnlyModel => PostgresCollation.GetCollations(model).ToArray(); #endregion Collation management - - #region Default column collation - - /// - /// Gets the default collation for all columns in the database, or if none is defined. - /// This causes EF Core to specify an explicit collation when creating all column, unless one is overridden - /// on a column. - /// - /// - ///

- /// See for another approach to defining a - /// database-wide collation. - ///

- ///

- /// For more information, see https://www.postgresql.org/docs/current/collation.html. - ///

- ///
- [Obsolete("Use EF Core's standard model bulk configuration API")] - public static string? GetDefaultColumnCollation(this IReadOnlyModel model) - => (string?)model[NpgsqlAnnotationNames.DefaultColumnCollation]; - - /// - /// Sets the default collation for all columns in the database, or null if none is defined. - /// This causes EF Core to specify an explicit collation when creating all column, unless one is overridden - /// on a column. - /// - /// - ///

- /// See for another approach to defining a - /// database-wide collation. - ///

- ///

- /// For more information, see https://www.postgresql.org/docs/current/collation.html. - ///

- ///
- [Obsolete("Use EF Core's standard model bulk configuration API")] - public static void SetDefaultColumnCollation(this IMutableModel model, string? collation) - => model.SetOrRemoveAnnotation(NpgsqlAnnotationNames.DefaultColumnCollation, collation); - - /// - /// Sets the default collation for all columns in the database, or null if none is defined. - /// This causes EF Core to specify an explicit collation when creating all column, unless one is overridden - /// on a column. - /// - /// - ///

- /// See - /// for another approach to defining a database-wide collation. - ///

- ///

- /// For more information, see https://www.postgresql.org/docs/current/collation.html. - ///

- ///
- [Obsolete("Use EF Core's standard model bulk configuration API")] - public static string? SetDefaultColumnCollation(this IConventionModel model, string? collation, bool fromDataAnnotation = false) - { - model.SetOrRemoveAnnotation(NpgsqlAnnotationNames.DefaultColumnCollation, collation, fromDataAnnotation); - return collation; - } - - /// - /// Returns the for the default column collation. - /// - /// The model. - /// The for the default column collation. - [Obsolete("Use EF Core's standard model bulk configuration API")] - public static ConfigurationSource? GetDefaultColumnCollationConfigurationSource(this IConventionModel model) - => model.FindAnnotation(NpgsqlAnnotationNames.DefaultColumnCollation)?.GetConfigurationSource(); - - #endregion Default column collation } diff --git a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlPropertyExtensions.cs b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlPropertyExtensions.cs index ce01fb60e..8e4869b7b 100644 --- a/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlPropertyExtensions.cs +++ b/src/EFCore.PG/Extensions/MetadataExtensions/NpgsqlPropertyExtensions.cs @@ -1142,23 +1142,6 @@ public static void SetTsVectorProperties( #endregion Generated tsvector column - #region Collation - - /// - /// Returns the collation to be used for the column - including the PostgreSQL-specific default column - /// collation defined at the model level (see - /// ). - /// - /// The property. - /// The collation for the column this property is mapped to. - [Obsolete("Use EF Core's standard model bulk configuration API")] - public static string? GetDefaultCollation(this IReadOnlyProperty property) - => property.FindTypeMapping() is StringTypeMapping - ? property.DeclaringType.Model.GetDefaultColumnCollation() - : null; - - #endregion Collation - #region Compression method /// diff --git a/src/EFCore.PG/Extensions/NpgsqlMigrationBuilderExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlMigrationBuilderExtensions.cs index 20848999b..35ac4667b 100644 --- a/src/EFCore.PG/Extensions/NpgsqlMigrationBuilderExtensions.cs +++ b/src/EFCore.PG/Extensions/NpgsqlMigrationBuilderExtensions.cs @@ -44,30 +44,4 @@ public static MigrationBuilder EnsurePostgresExtension( return builder; } - - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - [Obsolete("Use EnsurePostgresExtension instead")] - public static MigrationBuilder CreatePostgresExtension( - this MigrationBuilder builder, - string name, - string? schema = null, - string? version = null) - => EnsurePostgresExtension(builder, name, schema, version); - - /// - /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to - /// the same compatibility standards as public APIs. It may be changed or removed without notice in - /// any release. You should only use it directly in your code with extreme caution and knowing that - /// doing so can result in application failures when updating to a new Entity Framework Core release. - /// - [Obsolete("This no longer does anything and should be removed.")] - public static MigrationBuilder DropPostgresExtension( - this MigrationBuilder builder, - string name) - => builder; } diff --git a/src/EFCore.PG/Metadata/Internal/NpgsqlAnnotationProvider.cs b/src/EFCore.PG/Metadata/Internal/NpgsqlAnnotationProvider.cs index 0d9591058..a9493d6ae 100644 --- a/src/EFCore.PG/Metadata/Internal/NpgsqlAnnotationProvider.cs +++ b/src/EFCore.PG/Metadata/Internal/NpgsqlAnnotationProvider.cs @@ -97,20 +97,6 @@ public override IEnumerable For(IColumn column, bool designTime) } } - // If the property has a collation explicitly defined on it via the standard EF mechanism, it will get - // passed on the Collation property (we don't need to do anything). - // Otherwise, if a model-wide default column collation exists, pass that through our custom annotation. - // Note that this mechanism is obsolete, and EF Core's bulk model configuration can be used instead; but we continue to support - // it for backwards compat. -#pragma warning disable CS0618 - if (column.PropertyMappings.All(m => m.Property.GetCollation() is null) - && column.PropertyMappings.Select(m => m.Property.GetDefaultCollation()) - .FirstOrDefault(c => c is not null) is { } defaultColumnCollation) - { - yield return new Annotation(NpgsqlAnnotationNames.DefaultColumnCollation, defaultColumnCollation); - } -#pragma warning restore CS0618 - if (column.PropertyMappings.Select(m => m.Property.GetTsVectorConfig()) .FirstOrDefault(c => c is not null) is { } tsVectorConfig) { diff --git a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs index 38743f56e..db6cfe3fd 100644 --- a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs @@ -717,53 +717,6 @@ public override async Task Add_column_computed_with_collation(bool stored) AssertSql("""ALTER TABLE "People" ADD "Name" text COLLATE "POSIX" GENERATED ALWAYS AS ('hello') STORED;"""); } -#pragma warning disable CS0618 - [ConditionalFact] - public async Task Add_column_with_default_column_collation() - { - await Test( - builder => - { - builder.UseDefaultColumnCollation("POSIX"); - builder.Entity("People").Property("Id"); - }, - _ => { }, - builder => builder.Entity("People").Property("Name"), - model => - { - var table = Assert.Single(model.Tables); - Assert.Equal(2, table.Columns.Count); - var nameColumn = Assert.Single(table.Columns, c => c.Name == "Name"); - Assert.Equal("POSIX", nameColumn.Collation); - }); - - AssertSql("""ALTER TABLE "People" ADD "Name" text COLLATE "POSIX";"""); - } - - [ConditionalFact] - public async Task Add_column_with_collation_overriding_default() - { - await Test( - builder => - { - builder.UseDefaultColumnCollation("POSIX"); - builder.Entity("People").Property("Id"); - }, - _ => { }, - builder => builder.Entity("People").Property("Name") - .UseCollation("C"), - model => - { - var table = Assert.Single(model.Tables); - Assert.Equal(2, table.Columns.Count); - var nameColumn = Assert.Single(table.Columns, c => c.Name == "Name"); - Assert.Equal("C", nameColumn.Collation); - }); - - AssertSql("""ALTER TABLE "People" ADD "Name" text COLLATE "C";"""); - } -#pragma warning restore CS0618 - public override async Task Add_column_shared() { await base.Add_column_shared(); @@ -1705,30 +1658,6 @@ public override async Task Convert_string_column_to_a_json_column_containing_col Assert.Equal("42804", exception.SqlState); // column "Name" cannot be cast automatically to type jsonb } -#pragma warning disable CS0618 - public async Task Alter_column_change_default_column_collation() - { - await Test( - builder => builder.Entity( - "People", b => - { - b.Property("Id"); - b.Property("Name"); - }), - builder => builder.UseDefaultColumnCollation("POSIX"), - builder => builder.UseDefaultColumnCollation("C"), - _ => - { - // var table = Assert.Single(model.Tables); - // Assert.Equal(2, table.Columns.Count); - // var nameColumn = Assert.Single(table.Columns, c => c.Name == "Name"); - // Assert.Equal("C", nameColumn.Collation); - }); - - AssertSql("""ALTER TABLE "People" ALTER COLUMN "Name" TYPE text COLLATE "C";"""); - } -#pragma warning restore CS0618 - [Fact] public virtual async Task Alter_column_computed_set_collation() { @@ -1911,34 +1840,6 @@ public override async Task Create_index_descending_mixed() AssertSql("""CREATE INDEX "IX_People_X_Y_Z" ON "People" ("X", "Y" DESC, "Z");"""); } -#pragma warning disable CS0618 // HasSortOrder is obsolete - [Fact] - public virtual async Task Create_index_descending_mixed_legacy_api() - { - await Test( - builder => builder.Entity( - "People", e => - { - e.Property("Id"); - e.Property("X"); - e.Property("Y"); - e.Property("Z"); - }), - builder => { }, - builder => builder.Entity("People") - .HasIndex("X", "Y", "Z") - .HasSortOrder(SortOrder.Ascending, SortOrder.Descending), - model => - { - var table = Assert.Single(model.Tables); - var index = Assert.Single(table.Indexes); - Assert.Collection(index.IsDescending, Assert.False, Assert.True, Assert.False); - }); - - AssertSql("""CREATE INDEX "IX_People_X_Y_Z" ON "People" ("X", "Y" DESC, "Z");"""); - } -#pragma warning restore CS0618 - [Fact] public virtual async Task Create_index_descending_mixed_legacy_annotation() {