I set an existing property decimal
to decimal?
:
public decimal? TotalAmountTTC { get; set; }
Then I created a migration with add-migration
, it generated me this :
migrationBuilder.AlterColumn<decimal>(
name: "c0003_total_amount_ttc",
table: "t0003_transfer_request",
type: "decimal(13,4)",
nullable: true,
oldClrType: typeof(decimal),
oldType: "decimal(13,4)");
But after i execute update-database
, the column is still not nullable
:
When i run script-migration
to check the SQL generated, we can see it clearly doesn't care about the fact my property is now nullable:
ALTER TABLE "t0003_transfer_request" MODIFY "c0003_total_amount_ttc" decimal(13,4)
/
Am I doing something wrong? Is this a bug?
I've tried to set the IsRequired(false)
in the mapping, but same result.
builder.Property(tr => tr.TotalAmountTTC).HasColumnName("c0003_total_amount_ttc").IsRequired(false);