[6.x] Schema-qualify table names when dropping all FKs in SQL Server #30221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
compileDropAllForeignKeys
function in the SQL Server grammar previously assumed that all tables were in the default schema of the database connection, and so did not need to be qualified. The generated SQL would look for example likeALTER TABLE foos DROP CONSTRAINT ...
.With this change, the SQL will now look like
ALTER TABLE dbo.foos DROP CONSTRAINT ...
. Importantly this means that if there are other schemas used by the application, tables in them will have their FKs dropped correctly, as inALTER TABLE app.bars DROP CONSTRAINT ...
.