Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@ private Dictionary<string, string> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ await Test(
}

[Fact]
[UseCulture("de-DE")]
public virtual async Task Create_table_with_storage_parameter()
{
await Test(
Expand All @@ -321,6 +322,7 @@ await Test(
{
e.Property<int>("Id");
e.HasKey("Id");
e.HasStorageParameter("autovacuum_vacuum_scale_factor", 0.01);
e.HasStorageParameter("fillfactor", 70);
e.HasStorageParameter("user_catalog_table", true);
}),
Expand All @@ -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')
Expand All @@ -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);
""");
}

Expand Down
Loading