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 using AutoMigrate() to modify an existing ENUM field in a MySQL database, the changes are not applied. If an ENUM option is added or removed from the model, the corresponding column in the database remains unchanged, leading to inconsistencies between the model and the actual schema.
Example Code
Here are the two relevant commits that demonstrate the issue.
The other commits in the MR are not as important because the go-gorm/playground setup deletes tables before recreating them. Initially, this made it seem like there was no issue, but this approach is not suitable for a production environment.
Additionally, one commit disables dependency between pipeline jobs, which isn’t necessary here since I’m only targeting the MySQL driver. I don’t need to account for SQLite’s lack of enum support.
Lastly, the entire test is only reproducible on a local machine because databases in the pipeline lose their state between runs, meaning I can’t retain table state for the next pipeline execution.
The text was updated successfully, but these errors were encountered:
GORM Playground Link
go-gorm/playground#787
Description
When using AutoMigrate() to modify an existing ENUM field in a MySQL database, the changes are not applied. If an ENUM option is added or removed from the model, the corresponding column in the database remains unchanged, leading to inconsistencies between the model and the actual schema.
Example Code
Here are the two relevant commits that demonstrate the issue.
The other commits in the MR are not as important because the go-gorm/playground setup deletes tables before recreating them. Initially, this made it seem like there was no issue, but this approach is not suitable for a production environment.
Additionally, one commit disables dependency between pipeline jobs, which isn’t necessary here since I’m only targeting the MySQL driver. I don’t need to account for SQLite’s lack of enum support.
Lastly, the entire test is only reproducible on a local machine because databases in the pipeline lose their state between runs, meaning I can’t retain table state for the next pipeline execution.
The text was updated successfully, but these errors were encountered: