From bb90784c1126bca57114d81615f575a953ca5beb Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Mon, 9 Oct 2023 23:32:20 +0800 Subject: [PATCH] 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 --- .../Migrations/JetMigrationsSqlGenerator.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs index 335cbbc..b92797b 100644 --- a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs +++ b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs @@ -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);