backend: migration for recreating invite index#3328
Conversation
There was a problem hiding this comment.
Thanks!
There is a bit of redundancy here, as the index will get dropped and then rebuilt again after this (or any) migration runs: https://github.com/webrecorder/browsertrix/blob/main/backend/btrixcloud/db.py#L164. We used to do this routine of dropping the indexes on every startup and later modified it to only drop the indexes if new migrations actually ran.
So we could alternatively merge the new migration in #3113 instead, and that should fix the issue as well.
|
|
||
| # pylint: disable=unused-argument | ||
| def __init__(self, mdb: AsyncIOMotorDatabase, **kwargs): | ||
| self.mdb = mdb |
There was a problem hiding this comment.
| self.mdb = mdb |
This shouldn't be necessary, it will get set in the BaseMigration.__init__() call on the next line
There was a problem hiding this comment.
Oh good to know - I based this on one of the other migrations that did this, but now that I check the others that use self.mdb didn't assign it.
Aha, I was wondering about that! I did see the indices get bulk dropped/rebuilt in the logs when testing this, but it happening on any other migration explains it. Happy to just go with that other one assuming it's ready to go now. Two birds with one migration, etc |
I neglected to recreate the index when changing the expiration in #3284. We always create the indices on startup, not as a part of the migrations, but this will fail with a runtime error if the database already has this index with a different value in it.
Fixes #3327.