Run all SQL database upgrades in a test
We've badly coded database upgrades before, and it just bit us (@eighthave) when doing 0.102-alpha1.
The problem with code to upgrade the databases is that it's hard to test - you have to uninstall, install a previous version and upgrade. Since F-Droid takes a minute to set up and each build takes a few minutes, this means a whole ten minutes on average.
We should have a test, either unit or connected, that:
- starts at an early database version (e.g. one from a year ago, or perhaps even now as all past upgrades should work)
- creates the tables and adds dummy data, if necessary to trigger all the possible crashes
- goes through all the upgrades until it reaches the database version in master
Then, anyone who codes a database upgrade could run this test in less than a minute. And of course CI would catch it too.
CC @pserwylo