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
The database is initialized normally for the first time, but it crashes after restarting the application, returning the error invaild DDL, unbalanced brackets
According to my repeated debugging, the problem appears in migrate.go
At line 89, it would replace decimal (10,2) to ?, 2)
The text was updated successfully, but these errors were encountered:
I'm having the same issue, datatypes that would normally work with sqlite (they're targeted at postgres, things like gorm:"type:varchar(100)" and gorm:"type:numeric(3,1)") now do not.
To add more clarity (on the way to a reproducible, failing test)
This actually works fine gorm:"type:varchar(100)"
This fails with error "invaild DDL, unbalanced brackets": gorm:"type:numeric(3,1)"
This occurs whether using package gorm.io/driver/sqlite or github.com/glebarez/sqlite.
Interestingly, if you change db.AutoMigrate(&MyStruct{}) to db.Migrator().CreateTable(&MyStruct{}), it works (when creating new tables/a new database). But AutoMigrate() fails even when creating new tables/a new database.
UPDATE: It appears that a struct field with gorm:"type:numeric(3,1)" does work as expected in normal circumstances, but I get the above "unbalanced brackets" error when the table/struct also has a many2many relationship with another table via a ternary/join table.
GORM Playground Link
Description
The database is initialized normally for the first time, but it crashes after restarting the application, returning the error
invaild DDL, unbalanced brackets
According to my repeated debugging, the problem appears in
migrate.go
At line 89, it would replace
decimal (10,2)
to?, 2)
The text was updated successfully, but these errors were encountered: