Closed
Description
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