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: