Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(
if (rebuilds.Any())
{
operations.Add(
new SqlOperation { Sql = "PRAGMA foreign_keys = 0;", SuppressTransaction = true });
new SqlOperation { Sql = "PRAGMA defer_foreign_keys = ON;", SuppressTransaction = false });
}

foreach (var ((table, schema), _) in rebuilds)
Expand All @@ -458,12 +458,6 @@ private IReadOnlyList<MigrationOperation> RewriteOperations(
});
}

if (rebuilds.Any())
{
operations.Add(
new SqlOperation { Sql = "PRAGMA foreign_keys = 1;", SuppressTransaction = true });
}

foreach (var index in indexesToRebuild)
{
operations.Add(CreateIndexOperation.CreateFrom(index));
Expand Down
Loading