From 61a9e8a63eef2067403bbbeba5ea380be2812872 Mon Sep 17 00:00:00 2001 From: Mike Surcouf Date: Thu, 30 Jan 2020 01:06:02 +0000 Subject: [PATCH] Fixes #19720 single parenthesis defaults --- .../Scaffolding/Internal/SqlServerDatabaseModelFactory.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs b/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs index d5f2eadded8..c2d0b3ea9e4 100644 --- a/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs +++ b/src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs @@ -699,7 +699,7 @@ UNION ALL return defaultValue; } - if (defaultValue == "((0))") + if (defaultValue == "((0))" || defaultValue == "(0)") { if (dataTypeName == "bigint" || dataTypeName == "bit" @@ -716,7 +716,7 @@ UNION ALL return null; } } - else if (defaultValue == "((0.0))") + else if (defaultValue == "((0.0))" || defaultValue == "(0.0)") { if (dataTypeName == "decimal" || dataTypeName == "float" @@ -730,6 +730,7 @@ UNION ALL } else if ((defaultValue == "(CONVERT([real],(0)))" && dataTypeName == "real") || (defaultValue == "((0.0000000000000000e+000))" && dataTypeName == "float") + || (defaultValue == "(0.0000000000000000e+000)" && dataTypeName == "float") || (defaultValue == "('0001-01-01')" && dataTypeName == "date") || (defaultValue == "('1900-01-01T00:00:00.000')" && (dataTypeName == "datetime" || dataTypeName == "smalldatetime")) || (defaultValue == "('0001-01-01T00:00:00.000')" && dataTypeName == "datetime2")