Pending migrations check on startup. Includes index change migration#4746
Pending migrations check on startup. Includes index change migration#4746matthewmcgarvey wants to merge 3 commits intoiv-org:masterfrom
Conversation
| Invidious::Database::Migrator.new(PG_DB).check_pending_migrations | ||
|
|
||
| # Check table integrity | ||
| Invidious::Database.check_integrity(CONFIG) |
There was a problem hiding this comment.
I noticed this method while working... and this is a bit of a monster hidden behind a simple name. It performs database updates besides doing checks. This might have to be taken out completely once the migration files are for sure the way forward since it reads the sql files.
There was a problem hiding this comment.
Yeah, this is a remnant I haven't dare to touch. I think that it should be safe to remove all of that code.
|
One thing I just remembered is that, while currently no migrations are marked as required, it would probably be wise to mark most of them so that people get on the migration train. |
We could only mark the latest as required, that'd be enough. |
|
Thank you! I'll look into doing some guides for applying migrations manually. |
|
Need to update this PR to also drop the index that this new one replaces if it exists. |
When the app starts, it will check for any pending migrations and issue a warning (but allow the app to continue). Adds new functionality to migrations to mark them as required which, during the pending migration check, will cause the app to fail to start.
To test this, I took the migration from #2469 and included it here. It will not break anything if the migration is not run and seems useful for performance issues.
I know some are pushing towards automatically running migrations, but I am not. Feel free to push back