Skip to content

Commit

Permalink
use same sql for set default statement on mysql/mariadb and postgres (w…
Browse files Browse the repository at this point in the history
…oodpecker-ci#1540)

introduced by woodpecker-ci#1027 so it does not need a changelog or backport
  • Loading branch information
6543 authored Jan 14, 2023
1 parent fecb035 commit c276bc8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions server/store/datastore/migration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c276bc8

Please sign in to comment.