postgres icon indicating copy to clipboard operation
postgres copied to clipboard

fail to alter column

Open warren830 opened this issue 3 years ago • 0 comments

GORM Playground Link

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

Description

If we want to change column from varchar to int, it will report error like below: [2022-05-09 11:57:51] INFO [db] /opt/homebrew/Cellar/[email protected]/1.17.9/pkg/mod/gorm.io/driver/[email protected]/migrator.go:270 ERROR: column "xxx" cannot be cast automatically to type bigint (SQLSTATE 42804) [1.840ms] [rows:0] ALTER TABLE "xxx" ALTER COLUMN "xxx" TYPE bigint

We only need to append USING xxx::bigint in func AlterColumn in [email protected]/migrator.go

warren830 avatar May 09 '22 04:05 warren830