postgres icon indicating copy to clipboard operation
postgres copied to clipboard

AutoMigrate() panic handling model that has `gorm:"default"` columns

Open pnck opened this issue 2 years ago • 1 comments

GORM Playground Link

https://github.com/go-gorm/playground/pull/461

Description

Tested with postgres driver v1.3.1 to v1.3.3

Panic occurs only on v1.3.3

pnck avatar Apr 05 '22 06:04 pnck

Seeing same... I didn't change column type, but now getting this

2022/04/09 07:20:39 /Users/xxxx/go/pkg/mod/gorm.io/driver/[email protected]/migrator.go:252 ERROR: syntax error at or near "not" (SQLSTATE 42601)
master | [0.858ms] [rows:0] ALTER TABLE "mytable" ALTER COLUMN "data" TYPE jsonb not null default '{}'::jsonb

flarco avatar Apr 09 '22 10:04 flarco

tests pass in latest version.

jinzhu avatar Oct 08 '22 08:10 jinzhu