You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I modify a enum field with ALTER command, the generated models not added a new enum value, and it change the data type of field in struct as string instead of the "type ...Status string".
Relevant log output
No response
Database schema
CREATETABLEauthors (
id bigintprimary key,
status enum("ok", "init") default "init"not null
);
-- remove this alter to see the change in models.goALTERTABLE authors MODIFY status enum('init', 'done', 'canceled', 'processing', 'waiting') default "init"not null;
I got in a case similar to #1503. This PR will fix#1503.
I found one discrepancy between column definition between create table and alter definition. I fix it by defining a common sub function.
On generic engine update part, it was missing to create enum on alter table statement compared to create. I added an argument to the func createEnum to override previous definition when needed.
I added two tests to cover the two ALTER case MODIFY and CHANGE.
I only know very few part of the codebase so let me know If I need to change anything to make this merged.
Uh oh!
There was an error while loading. Please reload this page.
Version
1.12.0
What happened?
When I modify a enum field with ALTER command, the generated models not added a new enum value, and it change the data type of field in struct as string instead of the "type ...Status string".
Relevant log output
No response
Database schema
SQL queries
Configuration
No response
Playground URL
https://play.sqlc.dev/p/67134f04f43f5f6161fb11737e860c99c5db8a82b63d9f0a22e0f5707c500d57
What operating system are you using?
Linux
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: