0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-25 06:02:49 +01:00

Delete indexer DB entries when (re)creating index (#3385)

* comment
This commit is contained in:
Ethan Koenig 2018-01-17 13:51:07 -08:00 committed by Lauris BH
parent a880b17296
commit b0d5bb909b

View file

@ -86,6 +86,13 @@ func populateRepoIndexerAsynchronously() error {
return nil 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 var maxRepoID int64
if _, err = x.Select("MAX(id)").Table("repository").Get(&maxRepoID); err != nil { if _, err = x.Select("MAX(id)").Table("repository").Get(&maxRepoID); err != nil {
return err return err