summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
}