Inspiration

Production database outages frequently stem from deceptive SQL schema migrations: narrowing column types (VARCHAR(255) -> VARCHAR(80) or BIGINT -> INT) triggering full ACCESS EXCLUSIVE table rewrites, NOT NULL columns added without defaults, blocking CREATE INDEX builds, and dropped columns breaking rolling pod deployments.

What it does

MigraGuard parses BEFORE vs AFTER SQL DDL directly in the browser (zero backend or API key required) to prevent unsafe schema rollouts before they hit production:

  • Lock-Risk & Destructive Change Detection: Flags destructive DROP statements, narrowing type rewrites, NOT NULL lock traps, blocking CREATE INDEX builds without CONCURRENTLY, and unindexed foreign keys.
  • 0–100 Lock Risk Score: Quantifies operational downtime risk across each DDL diff.
  • Target Schema SVG Diagram: Renders a live interactive SVG entity-relationship / table diagram of the target schema.
  • 2-Phase Expand-and-Contract SQL Migration Plan: Auto-synthesizes a zero-downtime migration script using CONCURRENTLY, NOT VALID + VALIDATE CONSTRAINT, and phased column deprecation, exportable as Markdown.

How we built it & Verification

Built with TypeScript, Vite, Vitest, SQL, HTML5, and CSS3 using a deterministic client-side DDL parser and migration synthesizer.

  • Verified with 6/6 passing Vitest tests covering schema diffing, lock-risk scoring, expand-contract SQL generation, and edge cases.
  • Clean strict TypeScript check and production build via tsc --noEmit && vite build.

Built With

Share this project:

Updates

Submission history