Make the db timezone migration mysql compatible
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-06-30 11:29:47 +02:00
parent 1c93aab7e0
commit 9750a23dbe
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 1 deletions

View File

@ -649,7 +649,12 @@ create unique index UQE_users_namespace_id
}
case schemas.MYSQL:
sql = []string{
"ALTER TABLE " + table + " DROP COLUMN IF EXISTS " + colTmp + ";",
// mysql does not support the IF EXISTS part of the following statement. To not break
// compatibility with mysql over mariadb, we're not using it.
// The statement is probably useless anyway since its only purpose is to clean up old tables
// which may be leftovers from a previously failed migration. However, since the whole thing
// is wrapped in sessions, this is extremely unlikely to happen anyway.
//"ALTER TABLE " + table + " DROP COLUMN IF EXISTS " + colTmp + ";",
"ALTER TABLE " + table + " ADD COLUMN " + colTmp + " DATETIME NULL;",
// #nosec
"UPDATE " + table + " SET " + colTmp + " = IF(" + colOld + " = 0, NULL, FROM_UNIXTIME(" + colOld + "));",