Skip to content

reo7sp/two-step-migrate

Repository files navigation

two-step-migrate

SQL migration tool.

screenshot

This is tool is adapted for seamless deployments of backend code. Each migration has two steps: half and total.

Half migration is backward-compatible database migration, which allows to work previous and next version of your backend code simultaneously. In this migration you cannot remove or rename columns because in that case the old backend code will break.

Total migration is backward-not-compatible database migration.


Installation

Using precompiled binaries

The compiled binaries exist under the releases tab: https://github.com/reo7sp/two-step-migrate/releases

Using docker

Use reo7sp/two-step-migrate docker image.

Using go

go get github.com/reo7sp/two-step-migrate

Usage

two-step-migrate [command]

Available commands:

  • new — Create a new migration
  • up — Apply migration
  • down — Rollback migration

Required environment variables:

  • DATABASE_URL — DSN to the sql database.

Caveats

Currently supports only PostgreSQL.