From bf97c0023cacfd54b0294dc3ab126fff896c42f3 Mon Sep 17 00:00:00 2001 From: kolaente Date: Fri, 18 Dec 2020 16:55:24 +0100 Subject: [PATCH] Fix migration query for postgres --- pkg/migration/20201218152741.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/migration/20201218152741.go b/pkg/migration/20201218152741.go index edce7a54d..be709d224 100644 --- a/pkg/migration/20201218152741.go +++ b/pkg/migration/20201218152741.go @@ -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 }