If we can get a numeric out of the ComputedColumnSql string then we know it is a numeric constant. We can transfer that to DefaultValue in this case

pull/144/head
Christopher Jolly 2 years ago
parent 1df474d720
commit bb90784c11

@ -718,8 +718,15 @@ namespace Microsoft.EntityFrameworkCore.Migrations
if (operation.ComputedColumnSql != null)
{
ComputedColumnDefinition(schema, table, name, operation, model, builder);
return;
if (decimal.TryParse(operation.ComputedColumnSql, out decimal result))
{
operation.DefaultValue = result;
}
else
{
ComputedColumnDefinition(schema, table, name, operation, model, builder);
return;
}
}
var columnType = GetColumnType(schema, table, name, operation, model);

Loading…
Cancel
Save