From 757b0bc616216725b255924de57b771cd48ed0f3 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 9 Aug 2020 15:35:33 +0200 Subject: [PATCH] add a hackish migration for the changes expiration index. --- database/mongodb/changes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database/mongodb/changes.go b/database/mongodb/changes.go index 59de15c..49dca73 100644 --- a/database/mongodb/changes.go +++ b/database/mongodb/changes.go @@ -80,6 +80,9 @@ func (r *changeRepository) Remove(ctx context.Context, change models.Change) err func newChangeRepository(db *mgo.Database) (repositories.ChangeRepository, error) { collection := db.C("common.changes") + // Delete the old index if it exists. + _ = collection.DropIndexName("date_1") + err := collection.EnsureIndex(mgo.Index{ Name: "expiry", Key: []string{"date"},