Fix migration query for postgres
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
kolaente 2020-12-18 16:55:24 +01:00
parent 1b8b1c0539
commit bf97c0023c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 1 additions and 6 deletions

View File

@ -44,12 +44,7 @@ func changeColumnToBigint(x *xorm.Session, table, column string, nullable, defau
return err
}
case "postgres":
var notnull = " ALTER COLUMN `" + column + "` SET "
if !nullable {
notnull = "NOT"
}
notnull += " NULL"
_, err := x.Exec("ALTER TABLE " + table + " ALTER COLUMN `" + column + "` TYPE BIGINT" + notnull)
_, err := x.Exec("ALTER TABLE " + table + " ALTER COLUMN `" + column + "` TYPE BIGINT using `" + column + "`::bigint")
if err != nil {
return err
}