From 81f6cbb2547b6a6d4c2a13992bba08fafe1be3e6 Mon Sep 17 00:00:00 2001 From: Christopher Jolly Date: Mon, 10 Oct 2022 23:07:19 +0800 Subject: [PATCH] revert to use our stringtypemapping to generate the sql literal. Some regex depends on using this format to pick the filename from the connection string --- src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs | 6 +++--- .../JetMigrationsSqlGeneratorTest.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs index 114e216..0d5b379 100644 --- a/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs +++ b/src/EFCore.Jet/Migrations/JetMigrationsSqlGenerator.cs @@ -454,13 +454,13 @@ namespace Microsoft.EntityFrameworkCore.Migrations builder .Append("CREATE DATABASE ") - .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name)); + .Append(_stringTypeMapping.GenerateSqlLiteral(operation.Name)); if (!string.IsNullOrEmpty(operation.Password)) { builder .Append(" PASSWORD ") - .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Password)); + .Append(_stringTypeMapping.GenerateSqlLiteral(operation.Password)); } builder @@ -508,7 +508,7 @@ namespace Microsoft.EntityFrameworkCore.Migrations builder .Append("DROP DATABASE ") //.Append(ExpandFileName(operation.Name)) - .Append(Dependencies.SqlGenerationHelper.DelimitIdentifier(operation.Name)) + .Append(_stringTypeMapping.GenerateSqlLiteral(operation.Name)) .AppendLine(Dependencies.SqlGenerationHelper.StatementTerminator) .EndCommand(suppressTransaction: true); } diff --git a/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs b/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs index ea7bc1c..443ec44 100644 --- a/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs +++ b/test/EFCore.Jet.FunctionalTests/JetMigrationsSqlGeneratorTest.cs @@ -386,7 +386,7 @@ ALTER TABLE `Person` ALTER COLUMN [Id] bigint NOT NULL; new JetCreateDatabaseOperation { Name = "Northwind" }); AssertSql( - @"CREATE DATABASE `Northwind`; + @"CREATE DATABASE 'Northwind'; "); } @@ -511,7 +511,7 @@ ALTER TABLE `Person` ALTER COLUMN [Id] bigint NOT NULL; new JetDropDatabaseOperation { Name = "Northwind" }); AssertSql( - @"DROP DATABASE `Northwind`; + @"DROP DATABASE 'Northwind'; "); }