Skip to content

Conversation

mikeu
Copy link
Contributor

@mikeu mikeu commented Oct 8, 2019

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 like ALTER 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 in ALTER TABLE app.bars DROP CONSTRAINT ....

@mikeu mikeu changed the title Schema-qualify table names when dropping all FKs [6.x] Schema-qualify table names when dropping all FKs Oct 8, 2019
@mikeu mikeu changed the title [6.x] Schema-qualify table names when dropping all FKs [6.x] Schema-qualify table names when dropping all FKs in SQL Server Oct 8, 2019
@taylorotwell taylorotwell merged commit 56f12af into laravel:6.x Oct 9, 2019
@mikeu mikeu deleted the sql-server-schemas-in-drop-all-fks branch October 15, 2019 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants