Commit 7d5d7fe 1 parent e5ade7f commit 7d5d7fe Copy full SHA for 7d5d7fe
File tree 1 file changed +8
-19
lines changed
src/EFCore.PG/Migrations/Internal
1 file changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -16,26 +16,15 @@ protected override string ExistsSql
16
16
{
17
17
get
18
18
{
19
- var builder = new StringBuilder ( ) ;
20
-
21
- builder . Append ( "SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace WHERE " ) ;
22
-
23
19
var stringTypeMapping = Dependencies . TypeMappingSource . GetMapping ( typeof ( string ) ) ;
24
20
25
- if ( TableSchema is not null )
26
- {
27
- builder
28
- . Append ( "n.nspname=" )
29
- . Append ( stringTypeMapping . GenerateSqlLiteral ( TableSchema ) )
30
- . Append ( " AND " ) ;
31
- }
32
-
33
- builder
34
- . Append ( "c.relname=" )
35
- . Append ( stringTypeMapping . GenerateSqlLiteral ( TableName ) )
36
- . Append ( ");" ) ;
37
-
38
- return builder . ToString ( ) ;
21
+ return $@ "
22
+ SELECT EXISTS (
23
+ SELECT 1 FROM pg_catalog.pg_class c
24
+ JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace
25
+ WHERE n.nspname={ stringTypeMapping . GenerateSqlLiteral ( TableSchema ?? "public" ) } AND
26
+ c.relname={ stringTypeMapping . GenerateSqlLiteral ( TableName ) }
27
+ )" ;
39
28
}
40
29
}
41
30
@@ -60,4 +49,4 @@ public override string GetBeginIfExistsScript(string migrationId) => $@"
60
49
public override string GetEndIfScript ( ) =>
61
50
@" END IF;
62
51
END $EF$;" ;
63
- }
52
+ }
You can’t perform that action at this time.
0 commit comments