Make mysql work for some special cases (database case, views, foreign keys) #55
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.
Currently in MySQL if lower_case_table_names is set to 2 then when your database name has an uppercase character database-cleaner will fail because the
show tables
query returns using a column ofTables_in_<lowercase DB name>
Also, if you have views, it will fail.
Also, if any tables have foreign key constraints, it will fail.
Check the value of lower_case_table_names and if it is 2 then lowercasing the database name when constructing the expected column name seems to fix it.
Exclude views when getting table names to truncate so that it doesn't error on them.
Disable foreign key checks so that it doesn't fail on them