Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-30 22:06:11 +01:00

Fix the v78 migration script (#5776)

Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during Sync2. This should fix this issue.

Fix #5759

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2019-01-20 01:20:52 +00:00 committed by techknowlogick
parent 71c832e043
commit b0fbefc76b

View file

@ -21,6 +21,7 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
IsEmpty bool `xorm:"INDEX"` IsEmpty bool `xorm:"INDEX"`
} }
// First remove the index
sess := x.NewSession() sess := x.NewSession()
defer sess.Close() defer sess.Close()
if err := sess.Begin(); err != nil { if err := sess.Begin(); err != nil {
@ -37,6 +38,17 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
return fmt.Errorf("Drop index failed: %v", err) return fmt.Errorf("Drop index failed: %v", err)
} }
if err = sess.Commit(); err != nil {
return err
}
// Then reset the values
sess = x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}
if err := sess.Sync2(new(Repository)); err != nil { if err := sess.Sync2(new(Repository)); err != nil {
return err return err
} }