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

@ -717,10 +717,17 @@ namespace Microsoft.EntityFrameworkCore.Migrations
Check.NotNull(builder, nameof(builder)); Check.NotNull(builder, nameof(builder));
if (operation.ComputedColumnSql != null) if (operation.ComputedColumnSql != null)
{
if (decimal.TryParse(operation.ComputedColumnSql, out decimal result))
{
operation.DefaultValue = result;
}
else
{ {
ComputedColumnDefinition(schema, table, name, operation, model, builder); ComputedColumnDefinition(schema, table, name, operation, model, builder);
return; return;
} }
}
var columnType = GetColumnType(schema, table, name, operation, model); var columnType = GetColumnType(schema, table, name, operation, model);
//int has no size - ignore //int has no size - ignore

Loading…
Cancel
Save