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

Make mysql work for some special cases (database case, views, foreign keys) #55

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

eric-p-hutchins
Copy link

@eric-p-hutchins eric-p-hutchins commented Feb 28, 2017

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 of Tables_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

@eric-p-hutchins eric-p-hutchins force-pushed the uppercase-db-names-in-mysql branch from 32f9f83 to 6b8f85d Compare February 28, 2017 21:05
@eric-p-hutchins eric-p-hutchins changed the title Make mysql work for databases that are not all lowercase Make mysql work for some special cases (database case, views, foreign keys) Mar 1, 2017
@emerleite
Copy link
Owner

Hi @hutchiep190,

I just reviewed your PR. It's a good improvement to the library.

Can you please add some tests to the scenários you are covering so I can integrate quickly?

Cheers,

Emerson

@palashjhabak
Copy link

@emerleite Hi,

I was using your package for my tests when I came across Foreign Key Checks. I guess any good mysql db would have foreign key checks enabled. Are you by any chance active on this repo ? Even if you are not, would you mind accepting and merging a PR with the changes ?

@emerleite
Copy link
Owner

Hi @palashjhabak. I just need to checkit agian to see if not breaks anything.

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.

3 participants