-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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] Improved mysql drop all tables #20536
[5.5] Improved mysql drop all tables #20536
Conversation
On the PostGres version we escaped the database tables:
We should probably do that here too? |
@laurencei I tested this and it's working. we can't use double quotes but we can use backtick. Is it necessary? |
@lkmadushan it's necessary to use reserved words as identifiers. |
@@ -43,12 +43,34 @@ public function getColumnListing($table) | |||
*/ | |||
public function dropAllTables() | |||
{ | |||
$this->disableForeignKeyConstraints(); | |||
$tables = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to go further if $this->getAllTables()
is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will fix that 👍
55aa8ac
to
52060d4
Compare
*/ | ||
public function compileDropAllTables($tables) | ||
{ | ||
return 'drop table `'.implode('`,`', $tables).'`'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you not using our already existing "wrap" functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
c265a3d
to
6261227
Compare
6261227
to
ea3b259
Compare
current implementation runs N queries when database has N number of tables. this PR only run 2 queries to drop all tables.
Previous:
Now:
this implementation already exists for other database drivers. but mysql missed that somehow.