Most teams already have a record of their schema: the migrations folder in their repository. As of today you can build a diagram branch from it, at any commit.
How it works
Link a repository to a diagram, pick a branch or a commit, and the app reads the migration files at that point in history. It doesn't guess at the result by parsing the files. It replays them, in order, in a real database engine running in your browser: PGlite, a WebAssembly build of PostgreSQL. What comes out is the schema the database would have after running those migrations.
That matters for anything a parser would have to simulate. A column renamed in a later migration, a table dropped and recreated, a DO block that adds a constraint only if it's missing: PostgreSQL applies each one, and the app reads the result back from the database's own catalog.
A statement that fails doesn't stop the replay. It's listed as a warning beside the result, so you can see which migration a hand-written statement broke.
Replaying a long history takes memory, so it runs in a background worker with a time limit of 30 seconds. Once you check a commit out, its result is saved under the tree of your migrations folder, so any later commit that left that folder alone reuses it instead of replaying again.
Which layouts it reads
The app looks at the files under the folder you linked and picks the format from what it finds:
- Supabase migrations (
supabase/migrations/*.sql) - Prisma migrations (
migrations/<timestamp>_<name>/migration.sql) - Drizzle migrations, found by their
meta/_journal.json - Flyway (
V1__init.sql,V2__orders.sql, ordered by version, soV10comes afterV9) - golang-migrate (
*.up.sql; the.down.sqlfiles are ignored) - dbmate (
db/migrations) - a single
schema.sqlorstructure.sql, or any folder of.sqlfiles, in path order
Supabase projects come with roles such as authenticated and functions such as auth.uid() before your first migration runs. The replay creates stand-ins for those first, so a grant or a policy that names them doesn't fail.
A repository with a Prisma schema file, a Drizzle schema.ts or a DBML file and no migrations is read too, but by the app's parser rather than replayed. The preview says "parsed, not replayed: lower fidelity" when that happens.
A worked example
Say your repository keeps Supabase migrations, and main has three of them. The first creates customers:
create table customers (
id uuid primary key default gen_random_uuid(),
name text not null,
email text not null unique
);
The second adds orders:
create table orders (
id bigint generated always as identity primary key,
customer_id uuid not null references customers (id) on delete cascade,
total numeric(10,2) not null check (total >= 0),
created_at timestamptz not null default now()
);
create index orders_customer_id_idx on orders (customer_id);
The third renames a column, adds another, and has a mistake in it:
alter table customers rename column name to full_name;
alter table orders add column shipped_at timestamptz;
create index orders_status_idx on orders (status);
There's no status column, so PostgreSQL refuses the last statement. The replay records it and carries on. The branch you get has customers with id, full_name and email, and orders with its foreign key, check, index and the new shipped_at column. The preview shows "1 statement skipped"; click it and you see the file name, the error (column "status" does not exist) and the statement itself.
If the same file ran against production without error, that's worth knowing too: it usually means someone changed the database by hand.
Checking out a commit
- Open the Branches panel in the editor's sidebar, open the More branch actions menu and choose New branch from a Git commit…
- If the diagram has no repository yet, click Connect a repository and pick one. GitHub repositories are reached through the app's GitHub App on your organisation, or through your own GitHub account. The optional folder field starts as
migrations; set it to where your migrations live, such assupabase/migrations, or clear it to read from the repository root. - Pick a branch, or an older commit on it. The preview replays the migrations ("Replaying migrations…") and then shows the commit, how many tables came from how many files, any skipped statements, and how the result differs from the branch you're viewing.
- Name the branch, or keep the suggested
<ref>@<short sha>, such asmain@a1b2c3d. - Choose whether to track the ref and whether to lock the branch, then click Create branch.
A branch that tracks the repository
The Lock the branch option is on by default. Locked means nobody edits it by hand: it says what the repository says. Someone who manages the branch can unlock it later.
With Track on (it's offered when you pick a branch rather than a fixed commit), the branch follows that ref. When new commits change the migrations, the branch says "The migrations on main have changed since this commit." and offers Pull. With the GitHub App installed, a push tells the app straight away; otherwise the app compares the ref's migrations folder with the one the branch was built from.
Pulling them in is a reviewed change, the same screen you use for a merge: every table, column and constraint that changed is listed, and Sync applies the ones you keep. It works on a locked branch, because it's the repository speaking. Move to commit… does the same for any other commit, forwards or back, and Stop tracking or Track switches following on and off.
A branch can also stay unlocked and be edited like any other. That's the usual way to design a change: check out main, fork a branch, change it, and let the merge request write the migration.
Compare commits
Insights has a Git tab with the repository's history: the commits on a branch, tag or pull request that touched the migrations folder. Click one and the app shows the schema before and after it, side by side, table by table, even when nobody ever drew a diagram of either. If the change looks like a good starting point, Create branch from this commit turns it into a locked branch.
This is the quickest way to answer "when did this column appear?" without reading the migration files one by one.
Starting a diagram from a repository
New diagram has an "Import from a repository" option. Connect GitHub, pick the repository and branch, review what the migrations produce, and create the diagram with its main branch tracking that repository.
Limits
- Replaying happens in your browser, and PGlite needs a fair amount of memory. A history that takes longer than 30 seconds to replay is stopped with an error rather than left running.
- Only the folder you linked is read, and only the files that look like migrations for the detected format. Down migrations are left out.
- Extensions that exist only on a database server can't load in the browser. They're named on one line as skipped, since they rarely change the tables.
- Viewing a commit writes nothing. Only checking out or syncing saves a snapshot.