Skip to main content

Database Schema Diff

Paste two CREATE TABLE schemas to compare them and generate an ALTER TABLE migration script.

Paste two schemas and click Compare.

Frequently Asked Questions

What is a schema diff?▼

A schema diff (schema comparison) identifies the structural differences between two database schemas — added tables, dropped columns, changed data types, new indexes, modified constraints, etc. It's used to generate migration scripts when evolving a database schema from one version to another.

What is a database migration?▼

A database migration is a script that transforms a database schema from one state to another. Migrations are version-controlled and run in order. Tools like Flyway, Liquibase, Prisma Migrate, and Alembic manage migration files and track which have been applied to each environment.

What is a non-destructive vs destructive migration?▼

Destructive migrations permanently remove data (DROP TABLE, DROP COLUMN, TRUNCATE). Non-destructive migrations only add or modify structure without removing existing data (ADD COLUMN, CREATE INDEX, ADD CONSTRAINT). In production, always prefer non-destructive migrations and phase out deprecated columns after all code is updated.

What is a zero-downtime migration?▼

Zero-downtime migrations allow schema changes while the application is running. The pattern: 1) Add new column (nullable), 2) Deploy code that writes to both old and new columns, 3) Backfill existing rows, 4) Add NOT NULL constraint, 5) Deploy code that only uses the new column, 6) Drop old column. Never add NOT NULL without a default on large tables — it will lock the table.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →