mirror of
https://github.com/xataio/pgroll.git
synced 2024-08-15 16:50:22 +03:00
PostgreSQL zero-downtime migrations made easy
This change adds a new `sql` operation, that allows to define an `up` SQL statement to perform a migration on the schema. An optional `down` field can be provided, this will be used when trying to do a rollback after (for instance, in case of migration failure). A new trigger is installed to capture DDL events coming from direct user manipulations (not done by pg-roll), so they are stored as a migration, getting to know the resulting schema in all cases. |
||
---|---|---|
.github | ||
.vscode | ||
cmd | ||
examples | ||
pkg | ||
.golangci.yml | ||
docker-compose.yml | ||
go.mod | ||
go.sum | ||
main.go | ||
README.md |
pg-roll
⚠️ Under development ⚠️
PostgreSQL zero-downtime migrations made easy.
Getting started (development)
-
Bring a development PostgreSQL up:
docker compose up
-
Initialize pg-roll (first time only):
go run . init
-
Start a migration:
go run . start examples/01_create_tables.json
-
Inspect the results:
psql postgres://localhost -U postgres
\d+ public.* \d+ 01_create_tables.*
-
(Optional) Rollback the migration (undo):
go run . rollback
-
Complete the migration:
go run . complete