Open hackf5 opened 4 weeks ago
Version: Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4
Reproduction:
Add property public List<string> NewArray { get; set; } = []; to entity model.
public List<string> NewArray { get; set; } = [];
Add Migration.
Actual:
migrationBuilder.AddColumn<List<string>>( name: "new_array", table: "some_table", type: "text[]", nullable: false);
Expected:
migrationBuilder.AddColumn<List<string>>( name: "new_array", table: "some_table", type: "text[]", defaultValue: new List<string>(), nullable: false);
Because the migration does not specify a default value, when the migration is run, when the table some_table is not empty the migration fails because it attempts to insert null into the non-nullable column.
some_table
null
@hackf5 thanks for filing, but can you please show where this is actually affecting your program, e.g. causing an error?
Note added: migration fails due to attempt to insert null into non-nullable column.
Version: Npgsql.EntityFrameworkCore.PostgreSQL 8.0.4
Reproduction:
Add property
public List<string> NewArray { get; set; } = [];
to entity model.Add Migration.
Actual:
Expected:
Because the migration does not specify a default value, when the migration is run, when the table
some_table
is not empty the migration fails because it attempts to insertnull
into the non-nullable column.