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

Generator no longer supports MySQL 5.7 #111

Closed
kblomster opened this issue Dec 14, 2021 · 2 comments · Fixed by #112
Closed

Generator no longer supports MySQL 5.7 #111

kblomster opened this issue Dec 14, 2021 · 2 comments · Fixed by #112
Labels
bug Something isn't working

Comments

@kblomster
Copy link
Contributor

kblomster commented Dec 14, 2021

Describe the bug
I'm not sure if this strictly speaking a bug since AFAIK there's no list of officially supported DBMS versions, but it did work in 2.5.0 and isn't working in 2.6.0 so here we are.

Attempting to generate models for any schema on MySQL 5.7 results in the following database error:

Retrieving database information...
jet: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'primaryKeys AS (
        SELECT k.column_name
        FROM information_schema.table_constraint' at line 1

Environment (please complete the following information):

  • OS: macosx 12.0.1
  • Database: MySQL 5.7
  • Database driver: mysql
  • Jet version: 2.6.0

Expected behavior
I expect model generation to work, as it did in 2.5.0.

Additional information
The error appears to originate in GetTableColumnsMetaData() in jet/generator/mysql/query_set.go; it attempts to run a query that uses a CTE (WITH primaryKeys AS (...) and MySQL 5.7 doesn't support CTE's - which is one of the many reasons I despise it, but I have to use it for now, because of reasons.

It doesn't seem too difficult to rewrite the query to avoid the CTE (at the cost of some readability), so if you're willing to accept that tradeoff to keep supporting MySQL 5.7 I'd be very happy. I could make a PR?

@kblomster kblomster added the bug Something isn't working label Dec 14, 2021
@go-jet
Copy link
Owner

go-jet commented Dec 14, 2021

Yeah, it is a bug. Generator should work with MySQL 5.7.
Please use develop branch for PR.

@go-jet go-jet linked a pull request Dec 15, 2021 that will close this issue
@kblomster
Copy link
Contributor Author

Tested the develop branch now and it works fine again. Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants