Skip to content

Commit

Permalink
Merge pull request #223 from ValtsS/backport
Browse files Browse the repository at this point in the history
Foreign key names can contain symbols that require square brackets
  • Loading branch information
mganss authored Apr 5, 2024
2 parents 84e50fd + 98be81b commit 13d8da5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SyncChanges/Synchronizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,15 @@ private void Replicate(DatabaseInfo source, IGrouping<long, DatabaseInfo> destin
private void ReenableForeignKeyConstraint(Database db, ForeignKeyConstraint fk)
{
Log.Debug($"Re-enabling foreign key constraint {fk.ForeignKeyName}");
var sql = $"alter table {fk.TableName} with check check constraint {fk.ForeignKeyName}";
var sql = $"alter table {fk.TableName} with check check constraint [{fk.ForeignKeyName}]";
if (!DryRun)
db.Execute(sql);
}

private void DisableForeignKeyConstraint(Database db, ForeignKeyConstraint fk)
{
Log.Debug($"Disabling foreign key constraint {fk.ForeignKeyName}");
var sql = $"alter table {fk.TableName} nocheck constraint {fk.ForeignKeyName}";
var sql = $"alter table {fk.TableName} nocheck constraint [{fk.ForeignKeyName}]";
if (!DryRun)
db.Execute(sql);
}
Expand Down

0 comments on commit 13d8da5

Please sign in to comment.