-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Generated column should not be altered during automigration #5534
Comments
seeing the same issue @khalilsarwari |
We can support a struct tag
For non-breaking API changes, it will not work if How about this idea? |
This seems to be a size matching error. (As far as I know, if size is included), the type size will be composed of numbers or letters with parentheses at the end, not after a space. I'm not sure I know all the cases, is it possible we can fix it by modifying the regex? gorm:"->;type:bool GENERATED ALWAYS AS (some_expression) STORED;default:(-);"
gorm:"->;type:bool(should appear here) GENERATED ALWAYS AS (some_expression) STORED;default:(-);" |
It's possible. But I think it's cool to add perm for migration |
Usually, the addition of feat needs to have a real scene, and feat cannot be added to avoid bugs. |
Workaround for this issue in GORM: go-gorm/gorm#5534
Workaround for this issue in GORM: go-gorm/gorm#5534
Workaround for this issue in GORM: go-gorm/gorm#5534
Workaround for this issue in GORM: go-gorm/gorm#5534
Workaround for this issue in GORM: go-gorm/gorm#5534
GORM Playground Link
go-gorm/playground#496
Description
Once a generated column is created in postgres, it cannot be altered so it should be skipped during automigration.
This is also discussed here
Currently the automigrator tries to alter the column, resulting in an error like:
migrator.go:291 ERROR: syntax error at or near "GENERATED" (SQLSTATE 42601)
The text was updated successfully, but these errors were encountered: