1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-24 08:02:18 +02:00

use same sql for set default statement on mysql/mariadb and postgres (#1540)

introduced by #1027 so it does not need a changelog or backport
This commit is contained in:
6543 2023-01-14 11:52:41 +01:00 committed by GitHub
parent fecb0354bb
commit c276bc8937
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,10 +215,7 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
func alterColumnDefault(sess *xorm.Session, table, column, defValue string) error {
dialect := sess.Engine().Dialect().URI().DBType
switch dialect {
case schemas.MYSQL:
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` COLUMN `%s` SET DEFAULT %s;", table, column, defValue))
return err
case schemas.POSTGRES:
case schemas.MYSQL, schemas.POSTGRES:
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` SET DEFAULT %s;", table, column, defValue))
return err
case schemas.SQLITE: