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

Change the way that MySQL verifies if a table exists (hasTable) #2097

merged 1 commit into from Jun 9, 2017


Copy link

@rbadillap rbadillap commented Jun 3, 2017

Hi, on MySQL dialect, the method hasTable uses the following query to verify if a table exists:


This, could represent an issue if no parameter is defined (check this issue).

I've changed the way to verify the existence of the table, as @elhigu said in the same issue, the best way to accomplish this is checking MySQL's Information Schema

I've also added a new test passing an empty parameter on hasTable returning false.

With this PR, you can close the issue #2065.

Edited: The PR has not passed successfully the tests. This is not related with my changes, attached you can find a screenshot of the approved test that I've added.

screen shot 2017-06-02 at 10 44 55 pm

Copy link
Contributor Author

@rbadillap rbadillap commented Jun 3, 2017

BTW, I'm aware of this PR #2026, it has more options (like providing the schema within the same method as schema.tableName) than my solution, but I'm not seeing any update on that PR.

Let me know if you want to close this PR in order to give more importance to the PR mentioned above.

Copy link

@elhigu elhigu commented Jun 9, 2017

Looks good to me. Thanks! To me PR #2026 is kind of separate issue.

@elhigu elhigu merged commit 198da1b into knex:master Jun 9, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants