Painting by Jakob Alt
Basic tool to manage database migrations for PostgreSQL inspired by Flyway.
The program will read all sql files for a given directory, break all
statements in the file and execute all of them in order, a transaction
is open for each file. When reading the migration directory,
Grotto will order every file by their names, if all the scripts use
some kind of name versioning like,V1_XX.sql
, V2_XX.sql
, there
won't be any problems with the execution order, but if they don't
match any of these rules and just have plain text names, like,
create_table_x.sql
or create_index_y.sql
, you may run into some
trouble if your scripts must be executed in a different order.
make
go install ./cmd/grotto
./bin/grotto -help
docker-compose up -d
make
./bin/grotto -user user -password 123 -database test -dir test/valid_migration
There is a very simple shell script that runs docker compose, compiles
and runs the grotto test for some scripts under de test
directory.
./test/integration_tests.sh
- Enhance integration tests with psql validations, like validating a table was created, or some data was inserted only once.