Skip to main content
Schema migrations are the canonical example of a change you want to try three ways before committing to one. The tax is always the same: reset the database, reseed test data, apply migration, test. For every scenario. Vers removes the tax. Seed once, branch the live database, apply competing migrations against isolated copies, compare in parallel.

What you’ll build

  • A SQLite e-commerce database with a seeded base schema
  • Three parallel migration branches: premium-user features, inventory tracking, analytics
  • A workflow for comparing the three outcomes side by side
  • Time: ~25 minutes

Prerequisites

  • Vers CLI installed and authenticated
  • Basic familiarity with SQL

The idea

The expensive part of testing a migration isn’t the migration — it’s the base state the migration modifies. You want to test three different premium-features implementations against the same seeded database, and traditionally that means reseeding three times. With Vers you seed once, branch the live VM (which includes the SQLite file’s exact page layout, WAL state, and any in-memory buffers), then apply a different migration to each branch. Every branch sees the same starting data; each diverges only in the migration you run.

Step 1: Initialize the project

Default vers.toml resources are fine for SQLite:

Step 2: Boot the VM and seed the base schema

Inside the VM:
Seed the base schema — users, products, orders, plus sample rows:
Write a helper to dump schema + row counts so you can quickly diff branches later:
Exit back to your host shell:

Step 3: Branch at the pre-migration state

This is the decision point. Three migration candidates, one base state:
Four VMs running now — db-root as the baseline, three children each with an identical copy of the seeded database. No reseeding, no reset scripts.

Step 4: Apply three migrations in parallel

Each migration goes on its own branch. For genuine parallelism, open three terminals; for a linear read, just run them one after the other — the vers execute form is fine.

Migration A — premium user features

Migration B — inventory management

Migration C — analytics tables

Step 5: Compare outcomes

The inspect.sh helper you wrote in Step 2 is present in every branch — they inherit the parent’s filesystem at branch time. Run it on each:
Each branch shows a different schema. Every branch still has the baseline users/products/orders data unchanged — only the migration’s additions diverge.

Confirm the baseline is untouched

The root VM is exactly where you left it at Step 2:
No premium_benefits, no suppliers, no page_views. The migrations live only on their branches.

Step 6: Branch a branch — test a rollback scenario

A branch is itself a VM you can branch. Say you want to apply a risky secondary migration on top of migration-premium without disturbing it:
The risky change lives on its own branch. The parent migration branch is unaffected. This is the rollback story for free: every commit you take is a restoration point, every branch is an isolation boundary.

Step 7: Clean up

The -r tears down the root and all descendants.

The pattern

Seed expensive state once, branch at the decision point, diverge per scenario. Databases happen to be the cleanest example because the setup cost (schema + seed data) is visibly expensive, but the pattern is the same one as parallel scenario testing and agent swarms:
  • The setup prefix is paid once, at commit time
  • Every fork inherits the exact state — byte-identical, memory and filesystem both
  • Divergence only costs what it actually writes
Combine that with vers commit and you have a rollback primitive strong enough that “test three migrations and keep the best one” becomes one afternoon of work, not one sprint.

What’s next

Parallel scenario testing

Same pattern applied to end-to-end HTTP testing against a live stateful service.

Agent swarms

Branch a golden state into parallel coding agents.

vers branch

Every flag on the branch primitive.

Architecture

How commits, overlays, and content addressing make migration testing cheap.