diff --git a/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs b/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs index 636bcb050..ce4085df6 100644 --- a/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs +++ b/src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs @@ -2080,7 +2080,7 @@ private Dictionary GetStorageParameters(Annotatable annotatable) { bool b => b ? "true" : "false", string s => $"'{s}'", - _ => a.Value!.ToString()! + _ => Convert.ToString(a.Value, CultureInfo.InvariantCulture)! }); // TODO: Call this for AlterIndexOperation when that's added (https://github.com/dotnet/efcore/issues/20692) diff --git a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs index 06e8c29c0..665e2308d 100644 --- a/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs +++ b/test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs @@ -312,6 +312,7 @@ await Test( } [Fact] + [UseCulture("de-DE")] public virtual async Task Create_table_with_storage_parameter() { await Test( @@ -321,6 +322,7 @@ await Test( { e.Property("Id"); e.HasKey("Id"); + e.HasStorageParameter("autovacuum_vacuum_scale_factor", 0.01); e.HasStorageParameter("fillfactor", 70); e.HasStorageParameter("user_catalog_table", true); }), @@ -333,6 +335,11 @@ await Test( .Where(a => a.Name.StartsWith(NpgsqlAnnotationNames.StorageParameterPrefix, StringComparison.Ordinal)) .OrderBy(a => a.Name), annotation => + { + Assert.Equal(NpgsqlAnnotationNames.StorageParameterPrefix + "autovacuum_vacuum_scale_factor", annotation.Name); + Assert.Equal("0.01", annotation.Value); + }, + annotation => { Assert.Equal(NpgsqlAnnotationNames.StorageParameterPrefix + "fillfactor", annotation.Name); // Storage parameter values always get scaffolded as strings (PG storage is simply 'name=value') @@ -352,7 +359,7 @@ await Test( "Id" integer GENERATED BY DEFAULT AS IDENTITY, CONSTRAINT "PK_People" PRIMARY KEY ("Id") ) -WITH (fillfactor=70, user_catalog_table=true); +WITH (autovacuum_vacuum_scale_factor=0.01, fillfactor=70, user_catalog_table=true); """); }