summaryrefslogtreecommitdiffstats
path: root/models/repo_indexer.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2018-01-17 13:51:07 -0800
committerLauris BH <lauris@nix.lv>2018-01-17 23:51:07 +0200
commitb0d5bb909b2e558bee5d4d58f201012d5f8b4c1c (patch)
treede66e09d9e0ce0916f899d2278a7722dcd87a6b2 /models/repo_indexer.go
parenta880b1729656e4fe85e9ccf38608003cab5d5b01 (diff)
downloadgitea-b0d5bb909b2e558bee5d4d58f201012d5f8b4c1c.tar.gz
gitea-b0d5bb909b2e558bee5d4d58f201012d5f8b4c1c.zip
Delete indexer DB entries when (re)creating index (#3385)
* comment
Diffstat (limited to 'models/repo_indexer.go')
-rw-r--r--models/repo_indexer.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/models/repo_indexer.go b/models/repo_indexer.go
index 41c9f0fa31..be409f5162 100644
--- a/models/repo_indexer.go
+++ b/models/repo_indexer.go
@@ -86,6 +86,13 @@ func populateRepoIndexerAsynchronously() error {
return nil
}
+ // if there is any existing repo indexer metadata in the DB, delete it
+ // since we are starting afresh. Also, xorm requires deletes to have a
+ // condition, and we want to delete everything, thus 1=1.
+ if _, err := x.Where("1=1").Delete(new(RepoIndexerStatus)); err != nil {
+ return err
+ }
+
var maxRepoID int64
if _, err = x.Select("MAX(id)").Table("repository").Get(&maxRepoID); err != nil {
return err