Closed jeffry-luqman closed 1 year ago
In fact, it should throw an error if the default rules fail, instead of us defining the conversion rules.
for example
type ColumnStruct struct { name string IsActive string // set IsActive to "true" and alter column using `::INT::boolean` }
OK, I just sent the fix with this sql, please review again
ALTER TABLE "column_structs" ALTER COLUMN "is_active" TYPE boolean USING CASE WHEN "is_active" IN ('1','TRUE','true','T','t') THEN true ELSE false END
ok, I've fixed it
if there's nothing else to be fixed, can it be merged @a631807682 @jinzhu , please?
close #164 at v1.5.0
What did this pull request do?
Fix
USING ?::?
sql for boolean field onAlterColumn
funcWithout this, it will report error as I described in the issue https://github.com/go-gorm/postgres/issues/164
User Case Description
If we want to change column from smallint to boolean, it will report error like below:
We only need to fix sql become
USING xxx::int::boolean
for boolean field in funcAlterColumn
inpostgres@v1.4.8/migrator.go