diff options
author | Jakub Arbet <jakub.arbet@protonmail.com> | 2019-01-26 15:50:36 +0100 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-01-26 14:50:36 +0000 |
commit | a757920f4e47117d2d5b94dc3e675fb8987b02d9 (patch) | |
tree | 39e979e1584a18d581a5375b64bc1bb04412c6ec /models/migrations | |
parent | 8510ac2687e77a31ebd436cf09d7875a0ed9a112 (diff) | |
download | gitea-a757920f4e47117d2d5b94dc3e675fb8987b02d9.tar.gz gitea-a757920f4e47117d2d5b94dc3e675fb8987b02d9.zip |
Fix failing migration v67 (#5849)
Fixes #5848
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/v67.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/models/migrations/v67.go b/models/migrations/v67.go index d4a7497ec9..74d3f379cd 100644 --- a/models/migrations/v67.go +++ b/models/migrations/v67.go @@ -45,7 +45,7 @@ func removeStaleWatches(x *xorm.Engine) error { AccessModeRead // 1 ) - accessLevel := func(userID int64, repo *Repository) (int, error) { + accessLevel := func(e *xorm.Session, userID int64, repo *Repository) (int, error) { mode := AccessModeNone if !repo.IsPrivate { mode = AccessModeRead @@ -60,7 +60,7 @@ func removeStaleWatches(x *xorm.Engine) error { } a := &Access{UserID: userID, RepoID: repo.ID} - if has, err := x.Get(a); !has || err != nil { + if has, err := e.Get(a); !has || err != nil { return mode, err } return a.Mode, nil @@ -80,7 +80,7 @@ func removeStaleWatches(x *xorm.Engine) error { } repoCache := make(map[int64]*Repository) - err := x.BufferSize(setting.IterateBufferSize).Iterate(new(Watch), + err := sess.BufferSize(setting.IterateBufferSize).Iterate(new(Watch), func(idx int, bean interface{}) error { watch := bean.(*Watch) @@ -89,14 +89,14 @@ func removeStaleWatches(x *xorm.Engine) error { repo = &Repository{ ID: watch.RepoID, } - if _, err := x.Get(repo); err != nil { + if _, err := sess.Get(repo); err != nil { return err } repoCache[watch.RepoID] = repo } // Remove watches from now unaccessible repositories - mode, err := accessLevel(watch.UserID, repo) + mode, err := accessLevel(sess, watch.UserID, repo) if err != nil { return err } @@ -117,7 +117,7 @@ func removeStaleWatches(x *xorm.Engine) error { } repoCache = make(map[int64]*Repository) - err = x.BufferSize(setting.IterateBufferSize). + err = sess.BufferSize(setting.IterateBufferSize). Distinct("issue_watch.user_id", "issue.repo_id"). Join("INNER", "issue", "issue_watch.issue_id = issue.id"). Where("issue_watch.is_watching = ?", true). @@ -130,14 +130,14 @@ func removeStaleWatches(x *xorm.Engine) error { repo = &Repository{ ID: watch.RepoID, } - if _, err := x.Get(repo); err != nil { + if _, err := sess.Get(repo); err != nil { return err } repoCache[watch.RepoID] = repo } // Remove issue watches from now unaccssible repositories - mode, err := accessLevel(watch.UserID, repo) + mode, err := accessLevel(sess, watch.UserID, repo) if err != nil { return err } |