Skip to content
/ grotto Public

Basic tool to manage database migrations for PostgreSQL

Notifications You must be signed in to change notification settings

eaneto/grotto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grotto

codecov

The blue grotto in Capri

Painting by Jakob Alt

Basic tool to manage database migrations for PostgreSQL inspired by Flyway.

How it works

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.

Usage

Build

make

Installation

go install ./cmd/grotto

Help

./bin/grotto -help

Run example scripts with docker compose

docker-compose up -d
make
./bin/grotto -user user -password 123 -database test -dir test/valid_migration

Basic integration tests with docker compose

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

TODOs

  • Enhance integration tests with psql validations, like validating a table was created, or some data was inserted only once.

About

Basic tool to manage database migrations for PostgreSQL

Resources

Stars

Watchers

Forks

Releases

No releases published