This folder contains database migrations for the compliance service using golang-migrate/migrate.
This project requires using the migrate CLI to change the database schema and
to add new migrations. Please refer to the
documentation
for installation instructions or simply run make tools/migrate from the root of
this project.
These examples assume you have a PostgreSQL server accessible with a database
named compliance, and you've properly
escaped the database
password. You can refer to the deployment documentation in the
README.md for instructions on using terraform to deploy a
database using AWS RDS.
Apply all migrations:
$ POSTGRESQL_URL="postgres://$USER:$PASSWORD@$DATABASE_ENDPOINT/compliance
$ ./migrate -database $POSTGRESQL_URL -path migrations upApply all down migrations:
$ ./migrate -database $POSTGRESQL_URL -path migrations downTo run a quick and easy test of the migrations, use the test.sh script:
bash migrations/test.shIf you don't have the migrate CLI tool installed in your $PATH, run:
make tools/migrate
PATH=$PATH:$(pwd)/tools bash migrations/test.sh