SQL-first schema and migrations.

Model your schema in schema.sql. Generate migrations, or write your own. Works on Postgres, MySQL and SQLite.

$brew install reylosql/tap/reylo
Read the docs
01

The most advanced cross-dialect diff engine

Edit schema.sql, then generate a migration with one command. Editable as needed.

reylo/migrations/20261104140347_email_required.sql
alter table users alter column email set not null;
alter table users modify column email text not null;
create table new_users (id integer primary key, email text not null, name text not null) strict;
insert into new_users (id, email, name) select id, email, name from users;
drop table users;
alter table new_users rename to users;
02

Use the full power of your database

No lossy or limited DSLs. Declare views, functions, triggers, policies, checks, computed columns, and more.

reylo/schema.sql
create view active_users as
  select id, email from users where deleted_at is null;

create materialized view daily_signups as
  select date_trunc('day', created_at) as day, count(*)
  from users group by 1;
create function slugify(t text) returns text
  language sql immutable as $$
    select lower(regexp_replace(t, '[^a-z0-9]+', '-', 'gi'))
  $$;
create function touch() returns trigger language plpgsql as $$
begin new.updated_at := now(); return new; end $$;

create trigger users_touch before update on users
  for each row execute function touch();
create index users_unverified on users (created_at)
  where verified_at is null;

create unique index users_email on users (lower(email));
alter table documents enable row level security;
create policy documents_own on documents
  using (owner_id = current_setting('app.user_id')::integer);
create table bookings (
  seats integer not null check (seats > 0),
  starts_at timestamptz not null,
  ends_at timestamptz not null,
  check (ends_at > starts_at)
);
create table line_items (
  price numeric not null,
  qty integer not null,
  total numeric generated always as (price * qty) stored
);
create table events (
  payload jsonb not null check (jsonb_matches_schema('{
    "type": "object",
    "properties": { "x": { "type": "integer" } },
    "required": ["x"]
  }', payload))
);
create extension if not exists btree_gist;
create type mood as enum ('sad', 'ok', 'happy');
create domain email as text check (value like '%@%');
create type floatrange as range (subtype = float8);
create table rooms (room int, during tstzrange,
  exclude using gist (room with =, during with &&));
grant select on active_users to reporting;
comment on table users is 'The people who sign in';
03

Explicit disambiguation

When schema changes are ambiguous, Reylo asks you for clarification. Use --drop or --rename to disambiguate.

04

Fast iteration loops

Push schema.sql to your development database on every save. Then generate a migration once you're done iterating on schema.

05

Schemaless mode

For a DDL-first experience, just delete schema.sql. You (or your agents) can write raw DDL migrations.

06

Introspect anytime

Introspect the current database schema anytime in readable SQL.

07

Linear history via reylo.lock

Enforce linear migration history in Git with the reylo.lock lockfile.

08

Soundness guaranteed

Checksums in the lockfile prevent edited or reordered migrations. Untracked schema changes are detected and flagged.

09

Lock-free mode

For faster iteration, delete the lockfile. Unapplied migrations are run in lexicographic order. Reylo automatically prevents any ordering-dependent schema drift.

10

Works with your database

Works with Postgres, MySQL, SQLite—and all major database hosts and backends.

PostgresTestedMySQLTestedSQLiteTested
SupabaseTestedNeonTestedPlanetScaleTestedAmazon RDS and AuroraTestedGoogle Cloud SQLTestedAzure DatabaseTestedCloudflare D1TestedTursoTested
11

Switch easily

One command introspects your current schema, generates schema.sql, and creates your initial migrations/init.sql.

Ship faster with Reylo

$brew install reylosql/tap/reylo
Read the docs