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

[5.5] Don't try to drop Views when executing MySqlBuilder::dropAllTables() #20239

Merged
merged 1 commit into from Jul 25, 2017

Conversation

j859823
Copy link
Contributor

@j859823 j859823 commented Jul 24, 2017

The current MySqlBuilder::dropAllTables() function used by migrate:fresh uses "SHOW TABLES" and issues a "DROP TABLE" Query for all returned Values. This causes MySQL errors once a view exists in the database used for Laravel, as Views can only be droped by "DROP VIEW".

Not sure if using Views is a covered Use-Case for Laravel, but figured i might aswell submit a fix for it.

MySQL Documentation at https://dev.mysql.com/doc/refman/5.7/en/show-tables.html on SHOW TABLES:
"This statement also lists any views in the database. The optional FULL modifier causes SHOW TABLES to display a second output column with values of BASE TABLE for a table and VIEW for a view. "

@taylorotwell
Copy link
Member

@freekmurze may have some feedback here.

@freekmurze
Copy link
Contributor

In the laravel-migrate-fresh package we used a query to fetch the names of all real tables.

@tillkruss tillkruss changed the title Don't try to drop Views when executing MySqlBuilder::dropAllTables() [5.5] Don't try to drop Views when executing MySqlBuilder::dropAllTables() Jul 24, 2017
@taylorotwell taylorotwell merged commit 57d0777 into laravel:master Jul 25, 2017
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.

None yet

3 participants