Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreign key names can contain symbols that require square brackets #223

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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}]";

Check warning on line 390 in SyncChanges/Synchronizer.cs

View check run for this annotation

Codecov / codecov/patch

SyncChanges/Synchronizer.cs#L390

Added line #L390 was not covered by tests
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