gorm automigrator
fails with postgres
when a view
exists despite no updates to struct in migration
#5625
Labels
type:with reproduction steps
with reproduction steps
GORM Playground Link
go-gorm/playground#508
Description
Scenario:
go
type offloat64
data.Expected Result:
All steps complete successfully
Result Achieved
The migrations in step 3 fail.
ERROR: cannot alter type of a column used by a view or rule (SQLSTATE 0A000)
The alteration shouldn't be necessary given the struct hasn't changed at all.
In one case I found out this was because it was converting a column that was
numeric
todecimal
and failing to do so.steps to get around:
The tests will pass if you specify a particular postgres type to the data like so:
The text was updated successfully, but these errors were encountered: