Add sql-migrate subcommand to Praefect
Part of #2212 (closed)
Workflow:
- developer generates migration file with
_support/new-migration my_migration_name
- this script creates a new .go file; developer types SQL statements into the .go file
- commit .go file
- apply migrations with
praefect -config /path/to/conf.toml sql-migrate
By putting the migrations in .go files we automatically bundle the migrations into the Praefect binary, which is easier for deploying / shipping.
Writing SQL migrations as Go strings is not the nicest developer experience but it should work fine. If we want to, we can improve this later on without impacting users.
Example output:
% ./praefect -config praefect.config.toml sql-migrate
praefect sql-migrate: OK (applied 2 migrations)
Edited by GitLab Release Tools Bot