Reylo Migrate: Declarative schema.sql, Shadow Database Checks, and reylo.lock Instead of ORM DSLsNote · digest for November 26
Paper collage comparing a declarative database schema state with migrations
Note3 sections≈ 4 min

Reylo Migrate: Declarative schema.sql, Shadow Database Checks, and reylo.lock Instead of ORM DSLs

When starting a TypeScript backend, you immediately face a fork in the road for your database schema. Either you define tables in an ORM DSL like Prisma or Drizzle and quickly hit its ceiling, or you write raw SQL migrations by hand and lose sight of the big picture six months later. On November 21, 2026, Colin McDonnell (creator of Zod and tRPC) released Reylo Migrate under the MIT license (reylosql/reylo), keeping the entire schema in one schema.sql file.

Why Swap an ORM DSL for a Single schema.sql

ORM DSLs shine on simple tables, yet fall short on real databases. The moment you need PostgreSQL triggers, RLS access policies, partial indexes, or extensions, schema.prisma can't express them. You end up dropping raw SQL into migration files where changes get lost.

AI agents struggle even more: models write standard SQL with confidence, while tripping over DSL limits. The core Reylo engine derives TypeScript types from .sql files using content mappers in TypeScript 7.1, and Reylo Migrate brings the schema itself to pure SQL:

-- Entire database schema in one reylo/schema.sql (PostgreSQL)
create table users (
  id integer primary key,
  email text not null check (email like '%@%'),
  verified_at timestamptz,
  updated_at timestamptz not null default now()
);

-- Partial index and trigger right next to the table
create index users_unverified
  on users (id) where verified_at is null;

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 view verified_users as
  select id, email from users where verified_at is not null;

The Rust-based engine supports PostgreSQL, MySQL, and SQLite (STRICT, WITHOUT ROWID): it tracks partitions, domains, RLS policies, grants, and materialized views. Without a schema.sql file, it switches to schemaless mode—an AI agent edits the local dev database directly, and reylo migrate new captures a migration from it.

Shadow Databases Instead of SQL Parsing and Guardrails Against Risky Edits

Traditional tools parse SQL text themselves and trip on dialect quirks. Like pg-delta in the Supabase CLI, Reylo Migrate never guesses from text—and it supports MySQL and SQLite too. It spins up two empty shadow databases, applies schema.sql to one and past migrations to the other, then diffs the DBMS system catalogs.

Before writing a migration file, Reylo runs it against the shadow database, verifies the result matches schema.sql, and enforces preflight guardrails:

# Install and initialize reylo/ (schema.sql, migrations/, reylo.lock)
curl -fsSL https://reylo.dev/install.sh | sh
reylo migrate init

# Blocking changes and column drops require explicit flags
reylo migrate new widen_total --blocking
reylo migrate new drop_room --drop bookings.room

# Local run, status, dry-run, and deploy
reylo migrate dev
reylo migrate status
reylo migrate deploy --dry-run
reylo migrate deploy

If widening a column type in Postgres threatens a table rewrite under an ACCESS EXCLUSIVE lock, the CLI demands --blocking so reviewers spot the risk immediately. Dropping a column requires --drop, and renaming via --rename preserves data (unlike drop+add in Liquibase). Postgres indexes are created with CONCURRENTLY, constraints validate separately, and in MySQL each DDL statement runs in its own step due to implicit commits.

Strict Ordering with reylo.lock and Current Limits

Two Git branches with new migrations often merge cleanly, only to apply in a different order in production. In Drizzle Kit 0.x, _journal.json caused merge headaches, so Drizzle 1.0 RC removed it. Reylo Migrate gives you a choice via an optional reylo/reylo.lock:

# Schema hash and chain of migration checksums
schema: c7bf681b
migrations:
  - 20261104120000_users.sql c86e9de4
  - 20261104140347_add_bio.sql 78ad08c0

Each entry's hash depends on the previous one, so parallel PRs collide right in Git. With the lock file, reylo migrate deploy skips the shadow database, checks the schema fingerprint, and halts deployment on manual drift (a feature that costs $9/month in Atlas Pro, while Liquibase 5.0 moved to the non-free FSL). Without reylo.lock, the engine tests both orders in a shadow database and stops deployment only if they diverge.

On a large team, reylo.lock adds friction: even branches touching different tables will conflict, forcing the second developer to pull main and re-run reylo migrate dev. The project is also brand new, and custom operators, casts, and full-text search configs are currently checked by name only and must be written by hand.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3