Skip to content

Commit

Permalink
Use some more raw literal strings
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Jun 6, 2023
1 parent 4334ae0 commit 08b3fad
Show file tree
Hide file tree
Showing 6 changed files with 297 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ public override string GetBeginIfNotExistsScript(string migrationId)
var stringTypeMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));

return new StringBuilder()
.Append("IF NOT EXISTS(SELECT * FROM ")
.Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
.Append(" WHERE ")
.AppendLine("IF NOT EXISTS (")
.Append(" SELECT * FROM ")
.AppendLine(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
.Append(" WHERE ")
.Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
.Append(" = ")
.Append(stringTypeMapping.GenerateSqlLiteral(migrationId))
.Append(" = ").AppendLine(stringTypeMapping.GenerateSqlLiteral(migrationId))
.AppendLine(")")
.Append("BEGIN")
.ToString();
Expand All @@ -136,12 +136,13 @@ public override string GetBeginIfExistsScript(string migrationId)
var stringTypeMapping = Dependencies.TypeMappingSource.GetMapping(typeof(string));

return new StringBuilder()
.Append("IF EXISTS(SELECT * FROM ")
.Append(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
.Append(" WHERE ")
.AppendLine("IF EXISTS (")
.Append(" SELECT * FROM ")
.AppendLine(SqlGenerationHelper.DelimitIdentifier(TableName, TableSchema))
.Append(" WHERE ")
.Append(SqlGenerationHelper.DelimitIdentifier(MigrationIdColumnName))
.Append(" = ")
.Append(stringTypeMapping.GenerateSqlLiteral(migrationId))
.AppendLine(stringTypeMapping.GenerateSqlLiteral(migrationId))
.AppendLine(")")
.Append("BEGIN")
.ToString();
Expand Down
Loading

0 comments on commit 08b3fad

Please sign in to comment.