1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Use transaction in V102 migration (#12395)

The code for dropTableColumns has a slightly confusing portion whereby the session is committed for MSSQL but not for other variants.

The v102 migration doesn't actually start a transaction so this weirdness does not affect it. However it probably should attempt to run this in a transaction.

Signed-off-by: Andrew Thornton art27@cantab.net
This commit is contained in:
zeripath
2020-08-06 19:16:49 +01:00
committed by GitHub
parent 8cd7e93b9a
commit e17e3f71f4
2 changed files with 7 additions and 5 deletions

View File

@@ -11,5 +11,11 @@ import (
func dropColumnHeadUserNameOnPullRequest(x *xorm.Engine) error {
sess := x.NewSession()
defer sess.Close()
return dropTableColumns(sess, "pull_request", "head_user_name")
if err := sess.Begin(); err != nil {
return err
}
if err := dropTableColumns(sess, "pull_request", "head_user_name"); err != nil {
return err
}
return sess.Commit()
}