Skip to content

sqlc doesn't pick up column renames in mysql 5.7 #1600

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

Closed
dansimau opened this issue May 9, 2022 · 0 comments · Fixed by #1605
Closed

sqlc doesn't pick up column renames in mysql 5.7 #1600

dansimau opened this issue May 9, 2022 · 0 comments · Fixed by #1605
Labels
📚 mysql bug Something isn't working 🔧 golang

Comments

@dansimau
Copy link
Contributor

dansimau commented May 9, 2022

Version

1.13.0

What happened?

The syntax for renaming a column in mysql 5.7 is e.g.:

ALTER TABLE mytable CHANGE old_col_name new_col_name VARCHAR(100) NOT NULL;

In mysql >8, the simpler syntax is:

ALTER TABLE mytable RENAME old_col_name TO new_col_name;

sqlc supports the mysql 8 syntax, but it does not pick up column renames using the CHANGE keyword in the mysql 5.7 syntax.

mysql 5.7 (broken):
https://play.sqlc.dev/p/ce3be8094d518dd98ca61b9d8de5d5c59de5db37c577526cd2ce510b62dab9b5

mysql >8 (working):
https://play.sqlc.dev/p/a75ba62f791672e217f0a5bd73683f9a4f3a1364434e67015e09ba86d3222a30

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/ce3be8094d518dd98ca61b9d8de5d5c59de5db37c577526cd2ce510b62dab9b5

What operating system are you using?

macOS

What database engines are you using?

MySQL

What type of code are you generating?

Go

@dansimau dansimau added bug Something isn't working triage New issues that hasn't been reviewed labels May 9, 2022
@dansimau dansimau changed the title sqlc doesn't pick up table renames in mysql 5.7 sqlc doesn't pick up column renames in mysql 5.7 May 9, 2022
@kyleconroy kyleconroy added 📚 mysql 🔧 golang and removed triage New issues that hasn't been reviewed labels May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 mysql bug Something isn't working 🔧 golang
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants