mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-05-19 16:58:16 +00: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:
parent
fecb0354bb
commit
c276bc8937
|
@ -215,10 +215,7 @@ func dropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin
|
||||||
func alterColumnDefault(sess *xorm.Session, table, column, defValue string) error {
|
func alterColumnDefault(sess *xorm.Session, table, column, defValue string) error {
|
||||||
dialect := sess.Engine().Dialect().URI().DBType
|
dialect := sess.Engine().Dialect().URI().DBType
|
||||||
switch dialect {
|
switch dialect {
|
||||||
case schemas.MYSQL:
|
case schemas.MYSQL, schemas.POSTGRES:
|
||||||
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` COLUMN `%s` SET DEFAULT %s;", table, column, defValue))
|
|
||||||
return err
|
|
||||||
case schemas.POSTGRES:
|
|
||||||
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` SET DEFAULT %s;", table, column, defValue))
|
_, err := sess.Exec(fmt.Sprintf("ALTER TABLE `%s` ALTER COLUMN `%s` SET DEFAULT %s;", table, column, defValue))
|
||||||
return err
|
return err
|
||||||
case schemas.SQLITE:
|
case schemas.SQLITE:
|
||||||
|
|
Loading…
Reference in a new issue