Reylo Migrate

Put your schema in a SQL file, and Reylo Migrate writes the migrations

Model your schema in schema.sql, write each change into a migration with reylo migrate new, and run it with reylo migrate dev:

How the migration commands move between schema.sql, the migrations and the database. reylo migrate new writes a migration from schema.sql into the migrations folder, whose reylo.lock records their order. reylo migrate dev and reylo migrate deploy run the migrations on the database. Off to the sides, skipping the migrations: reylo migrate init writes schema.sql from an existing database, and reylo db push changes the database straight from schema.sql.schema.sqlmigrations/reylo.lockDatabasereylo migrate newreylo migrate {dev|deploy}reylo migrate initreylo db push

Basic usage

Install the reylo command:

brew install reylosql/tap/reylo
npm install --global reylo
curl -fsSL https://reylo.dev/install.sh | sh
irm https://reylo.dev/install.ps1 | iex
scoop bucket add reylo https://github.com/reylosql/scoop-bucket
scoop install reylo

Start your migrations from your database:

$ reylo migrate init
✓ Started reylo/ from postgres://localhost:5432/app
  reylo/
  ├── schema.sql          this database's schema
  ├── migrations/
  │   └── init.sql        the same, recorded as run here
  └── reylo.lock          the order the migrations run in

Commit the reylo directory to version control (change the path with dir in .reylo.yaml).

Edit schema.sql:

schema.sql
create table users (
  id integer primary key,
  email text not null
  email text not null, 
  bio text
);

Write the migration:

$ reylo migrate new add_bio
✓ Wrote reylo/migrations/20261104140347_add_bio.sql
  + column users.bio text

The generated migration is plain SQL. Edit it directly to add data migrations:

20261104140347_add_bio.sql
alter table  add column bio text;

Run it on your development database:

$ reylo migrate dev
Applying to postgres://localhost:5432/app
  ✓ 20261104140347_add_bio.sql  applied · 4 ms
✓ Wrote reylo/reylo.lock

Commit it with the lock, and deploy:

$ reylo migrate deploy
Applying to postgres://db.example.com/app
  ✓ 20261104140347_add_bio.sql  applied · 12 ms
✓ Applied 1 migration

A coding agent can set it up for you: