Model your schema in schema.sql. Generate migrations, or write your own. Works on Postgres, MySQL and SQLite.
Edit schema.sql, then generate a migration with one command. Editable as needed.
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;
No lossy or limited DSLs. Declare views, functions, triggers, policies, checks, computed columns, and more.
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';
When schema changes are ambiguous, Reylo asks you for clarification. Use --drop or --rename to disambiguate.
Push schema.sql to your development database on every save. Then generate a migration once you're done iterating on schema.
For a DDL-first experience, just delete schema.sql. You (or your agents) can write raw DDL migrations.
Introspect the current database schema anytime in readable SQL.
reylo.lockEnforce linear migration history in Git with the reylo.lock lockfile.
Checksums in the lockfile prevent edited or reordered migrations. Untracked schema changes are detected and flagged.
For faster iteration, delete the lockfile. Unapplied migrations are run in lexicographic order. Reylo automatically prevents any ordering-dependent schema drift.
Works with Postgres, MySQL, SQLite—and all major database hosts and backends.
One command introspects your current schema, generates schema.sql, and creates your initial migrations/init.sql.