Drizzle Migration Guard
Catch destructive Drizzle migrations before they run.
drizzle-kit generate produces SQL migrations — but nothing tells you "this migration will DROP a column with data in it" until it's too late. Drizzle Migration Guard lints your Drizzle schema, previews exactly what each migration will do in plain English, and scores the risk: 🟢 low, 🟡 medium, 🔴 high.
Local-first: your schema never leaves your machine. No cloud, no accounts, no telemetry — for the free tier or Pro.
Install
Install the .vsix directly (until the Marketplace listing goes live):
- In VS Code:
Extensions → ··· → Install from VSIX…
- Pick
drizzle-migration-guard-0.1.0.vsix
- Open a project with a
drizzle.config.* file — the extension activates automatically.
What's free
- Schema lint — flags common Drizzle mistakes in your
*.ts schema files:
- tables without primary keys
serial() columns without .primaryKey()
- nullable columns with no default (did you mean
.notNull()?)
- mixed snake_case / camelCase naming in one schema
- indexes on boolean (low-cardinality) columns
- Migration diff preview — open any generated
.sql migration and get a human-readable summary: tables added/dropped, columns added/dropped/altered, index and constraint changes.
- Destructive-operation highlighting —
DROP TABLE, DROP COLUMN, type narrowing (e.g. text → varchar(50)), and NOT NULL additions get red-flagged right in the editor.
- Status bar risk indicator — 🟢/🟡/🔴 for your whole migration set, updated as you edit.
dmg check — command (Ctrl/Cmd+Shift+P → DMG: Check migrations in workspace) for a full plain-English report.
Pro — $5/month or $48/year
Free shows you the risk. Pro helps you fix it and enforces it in CI:
- Severity levels — tune every rule (
dropColumn, typeNarrowing, addNotNull, …) to info / warn / block via the dmg.ruleSeverity setting.
- Safe-migration rewrite — one click turns a destructive migration into a commented, multi-step safe version (rename-first, backfill-then-enforce, add/swap/drop column patterns).
- Seed data generator — realistic seed scripts generated from your schema: pick a schema file, choose rows per table, and get Postgres
INSERTs with foreign keys wired to parent rows, enum values, and type-aware sample data.
- CI mode —
dmg check --ci fails the build on blocking issues; drop this into your workflow:
# .github/workflows/migration-guard.yml
name: Migration Guard
on: [push, pull_request]
jobs:
guard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm i -g drizzle-migration-guard-ci # headless runner (launch)
- run: dmg check --ci ./drizzle
env:
DMG_LICENSE_KEY: ${{ secrets.DMG_LICENSE_KEY }}
- Migration audit log — who checked what, when, per project.
Activate with DMG: Activate Pro license and paste your Lemon Squeezy key. The key is validated live against Lemon Squeezy's license API and stored in VS Code's SecretStorage (OS keychain); only an active key unlocks Pro, and DMG: Deactivate Pro license on this machine frees the activation slot. Without a valid key, Pro commands prompt for one instead of failing silently — the free tier always keeps working.
Supported dialects
Postgres first (Drizzle's biggest user base). MySQL and SQLite parsing arrive in v1.1.
Privacy
No telemetry. Free-tier analysis runs entirely inside VS Code on your machine. The only network calls are the Pro license checks: your license key and a machine-derived instance name go to Lemon Squeezy's license API when you activate, deactivate, or re-validate Pro — nothing else leaves your machine.