[keyserver] Initialize MySQL databases with the latest migration version
Summary:
Right now, new databases initialized with setupDB will start with no db_version in the metadata table, which corresponds to a value of -1.
This forces the migrate() code to run every single migration for the new database.
Instead, I think we should assume that setupDB is updated for any schema changes. That requires us to land changes to setupDB at the same time as introducing migrations. We should keep this requirement in mind, but I think we have stuck with it in the past.
Depends on D4154
Test Plan:
Create a keyserver/.env file, eg.:
COMM_MYSQL_DATABASE=commdev COMM_MYSQL_USER=commdev COMM_MYSQL_PASSWORD=pass
And then run the Docker image: cd keyserver && docker-compose down -v && docker-compose up --build
Before this diff, you should see console logs indicating the migrations are being run. After this diff, no migrations are run, and the database is initialized with a version of 2 (latest migration value)
Reviewers: palys-swm, atul
Reviewed By: palys-swm, atul
Subscribers: Adrian, yayabosh
Differential Revision: https://phabricator.ashoat.com/D4155