← Back to Blog
Story / Founder

How I Diagram a Database Migration Before I Run It

How I Diagram a Database Migration Before I Run It

A schema change that only lives in a text file is easy to run and hard to reverse in your head. That is why I draw a database migration diagram before I run it: before and after on one page, the ordered steps between them, and a clear mark for where rollback stops being simple.

The sections below cover what belongs on that page, what the picture can catch, and how reviews use it. ByteDiagram, introduced when the tool comes up, is our product, made by us. Read that part as a disclosed founder's note.

Why a migration script is not a plan on its own

A schema migration plan that starts as a list of statements can look complete while still hiding order. Add a column, backfill it, switch reads, then drop the old one — each step is short on its own, and each one changes what a rollback can still undo. Written as a flat script, those differences blur.

Martin Fowler's writing on evolutionary database design treats database changes as migrations that sit under the same discipline as application code: continuous integration, every developer able to apply the change, and schema treated together with the data that must move with it. The useful borrow for a founder habit is not a tool brand. It is the idea that a change is a sequence you can show, not only a file you can execute.

Parallel change shows up often when a column is split or renamed. The new shape lands first, both shapes coexist while data and callers move, and only then does the old shape leave. Without a picture, that coexistence is easy to compress into one vague "migrate the column" line that nobody can review.

Risk is rarely the SQL keyword itself. Risk is which service still reads the old column during the window, which write path still fills it, and whether a failed step leaves the system in a state you can reverse. A diagram makes those questions visible before anyone opens a console.

What goes on the page

As general guidance for a before and after schema diagram, put the starting tables on one side and the ending tables on the other. Between them, list the ordered steps that actually run: add columns, backfill, dual write if you need it, switch reads, stop old writes, drop what is left. Mark which app or service touches which table at each stage.

The table shapes themselves are not this post's job. For drawing the tables and relationships themselves, the ER guide stays the reference. A migration diagram borrows those shapes only as before and after snapshots, then spends its ink on the change between them.

Official Postgres documentation on modifying tables lists the kinds of definition changes people actually make: adding or removing columns, adding or removing constraints, changing defaults or types, renaming columns or tables. Those are structural edits, separate from editing the rows inside. On a migration page, that distinction matters: one box is the structure you intend to reach, another is the data move that has to finish before you can drop the old structure.

Support words such as backfill, dual write, lock, rollback and cutover earn a place when they name a real step or a real risk. The page does not need every index name. It needs enough order that a reviewer can ask "what still writes here?" and get an answer from the picture.

An example database migration diagram drawn for this post: App above Before and After dashed sections for a users table (name split into first_name and last_name), ordered steps add columns, backfill, switch reads, stop old writes and drop old column, with a dashed rollback-limit line labelled rollback is easy up to here

Above is a sample migration drawn for this article rather than a production change of mine. An App box at the top reads and writes into both stages. A dashed Before section shows a users table with id and name; a dashed After section shows id, first_name and last_name. Between them the ordered steps are add columns, backfill, switch reads, stop old writes and drop old column. A dashed rollback-limit line after switch reads is labelled "rollback is easy up to here".

What the picture can catch

In my view, the picture earns its keep when an ordering mistake becomes visible before production. A backfill that was written after a drop, a read switch that still pointed at a column about to vanish, a service nobody remembered still writing the old shape — those are the kinds of gaps a flat script hides and a labelled sequence shows.

Fowler's example of splitting a packed inventory code into separate columns is useful as a shape, not as a claim about any one product. The work is a series of structural adds, a data move into the new fields, application changes to use them, and only then a cleanup of the old field. Drawn as ordered boxes, that sequence is reviewable. Spoken as "we migrated inventory_code", it is not.

Continuous integration of database changes, in that same body of practice, assumes the migration is something a build can apply to its own copy. A diagram does not replace that automation. It gives humans a shared view of the same sequence the automation will run, so the review happens on order and ownership, not on a surprise at cutover.

The page is not a promise that the migration will be painless. It is a plan of the change you intend to run, so the room can argue with the plan while argument is still cheap.

How I draw and share it

For most migrations, one still image does the job, attached where the change is reviewed: the pull request, the ticket or the migration's wiki page.

For readers trying the same page in ByteDiagram, these pieces apply. The Icons panel includes built-in icons and AWS Services for cloud stores. Use a Section ("Dashed zone for grouping steps") to outline before, during and after, or to separate the app from the database. Templates offer a starting arrangement; Auto-arrange tidies positions afterward.

Once the order of steps holds up, its Export menu includes PNG, SVG and Animated GIF (checked 30 Oct 2026). A still image is the practical choice for most migration reviews, because the page is meant for markup in a pull request or a ticket rather than playback.

Live catalog browsers that draw their own graphs sit outside this post and were not tested by us. A migration sketch records the intended sequence and the rollback line the team agrees on, without depending on any vendor console.

Before the next production change, sketch the schema steps in the guest canvas before touching production. Editing in that guest view does not require an account.

Where the rollback line goes

A database migration rollback plan is only as honest as the line you draw on the page. In my view, mark the last step after which reverse is no longer a simple undo — often after reads have switched, or after the old column is gone. Everything before that line can still be discussed as reversible; everything after it needs a forward fix, not a fantasy of rewind.

Do not pretend the diagram knows a vendor's locking behaviour unless you have cited docs for that claim. The page can still show where a long backfill sits relative to a cutover, and which connections must stay healthy while both shapes exist. For traffic sitting in front of Postgres during that window, see how connections queue up in front of Postgres.

Cutover is then a labelled moment, not a mood. The diagram should make clear which writers stop, which readers move, and what you will check before calling the change done. If those answers are missing, the picture is not finished — and neither is the migration.

Keeping the rollback line visible also stops a review from arguing about two different meanings of "safe". Safe to reverse and safe to leave running are different questions. One belongs before the line; the other belongs after it.

FAQ

What should a database migration diagram show?

In my view, it should show the before schema, the after schema, the ordered steps between them, which service reads or writes each table, and the point where rollback stops being simple. It does not need every column. The goal is a page you can review before anyone runs the change.

Is a migration diagram the same as an ER diagram?

No. An ER diagram shows the shape of the tables and how they relate. A database migration diagram shows the change itself: what moves from before to after, in what order, and where you can still reverse course. Keep the ER post for the shapes; keep this page for the plan.

Should I animate the migration steps?

A still page is enough for most migration reviews. Timeline controls and an Animated GIF help only when the order of steps itself is what people keep mixing up. For many teams, a labelled still image is easier to attach to a pull request or a ticket.

Sources

Links below were checked on 30 October 2026.

Draw the migration before you run it

Pick the next schema change on your list. Draw before and after, number the steps, mark where rollback stops being easy, and put the picture next to the script. Ask once whether every service that still touches the old shape is on the page. Then run the change only after the picture holds up.

Draw the migration before you run it

ByteDiagram is our own tool. Fence before and after with dashed sections, order the steps between them, mark the rollback line, and export a still image for the review.

Visit ByteDiagram