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
If we want to change boolean column from smallint with default value to boolean, it will report error like below:
2023/05/09 15:56:04 /home/ubuntu/temp/gorm-playground/main_test.go:41 ERROR: default for column "boolean_column" cannot be cast automatically to type boolean (SQLSTATE 42804)
[0.654ms] [rows:0] ALTER TABLE "column_structs" ALTER COLUMN "boolean_column" TYPE boolean USING "boolean_column"::INT::boolean
We only need to drop existing default value in func AlterColumn in postgres@v1.5.0/migrator.go
The text was updated successfully, but these errors were encountered:
…t value to boolean in postgres (#180) (#181)
* fix : fail to alter column from smallint to boolean
* fix : fail to alter column from smallint to boolean
* fix : fail to alter column from string to boolean
* fix : fail to alter column from string to boolean if the value is "false" in string
* move using conversion expression to func
* move using expression to func
* fix : fail to alter existing boolean column from smallint with default value to boolean in postgres (#180)
* isUncastableDefaultValue
* ModifyColumn & DropDefaultValue
* ModifyColumn + DropDefaultValue > modifyColumn
GORM Playground Link
go-gorm/playground#595
Description
If we want to change boolean column from smallint with default value to boolean, it will report error like below:
We only need to drop existing default value in func
AlterColumn
inpostgres@v1.5.0/migrator.go
The text was updated successfully, but these errors were encountered: