summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-01-20 01:20:52 +0000
committertechknowlogick <hello@techknowlogick.com>2019-01-19 20:20:52 -0500
commitb0fbefc76bd6fccb58c2b9aa47cab4110c6420f9 (patch)
treec3b4d1b9fff861fc8ca60b3f39459693315b3f37 /models
parent71c832e0432dde04ace8eb46a80c7add9819ec05 (diff)
downloadgitea-b0fbefc76bd6fccb58c2b9aa47cab4110c6420f9.tar.gz
gitea-b0fbefc76bd6fccb58c2b9aa47cab4110c6420f9.zip
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>
Diffstat (limited to 'models')
-rw-r--r--models/migrations/v78.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/models/migrations/v78.go b/models/migrations/v78.go
index aebbf2c40e..c12d18581c 100644
--- a/models/migrations/v78.go
+++ b/models/migrations/v78.go
@@ -21,6 +21,7 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
IsEmpty bool `xorm:"INDEX"`
}
+ // First remove the index
sess := x.NewSession()
defer sess.Close()
if err := sess.Begin(); err != nil {
@@ -37,6 +38,17 @@ func renameRepoIsBareToIsEmpty(x *xorm.Engine) error {
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 {
return err
}