SQL Migration Risk Checker for CI and AI Workflows

DeltaScope is an offline-first SQL migration risk checker for MySQL, TiDB, and PostgreSQL. It reviews both DDL and DML statements, returning structured findings with blocker, warning, and notice severities. Use it from the CLI, in CI pipelines, via HTTP service, through the MCP server for AI agents, or embed it via the Go SDK.

Catch risky SQL before it ships

Destructive DDL

$ deltascope audit --sql "ALTER TABLE users DROP COLUMN age;"

Verdict: reject
Statements: 1
Blockers:   1

Statement 1: ALTER TABLE
- [blocker] ddl.alter.drop.column: dropping column "age" is a destructive change

Unguarded DML

$ deltascope audit --sql "DELETE FROM users;"

Verdict: reject
Statements: 1
Blockers:   1

Statement 1: DELETE
- [blocker] dml.where.require: UPDATE and DELETE statements must include a WHERE clause

Integration points

AI SQL review

DeltaScope ships an MCP stdio server that AI coding agents call directly. Install it once and every SQL edit in your AI session gets audited automatically.

claude mcp add --scope user deltascope -- npx -y @fanduzi/deltascope-mcp

CI SQL audit

# GitHub Actions
- name: Audit SQL migrations
  run: |
    deltascope audit \
      --file ./migrations.sql \
      --format github-actions \
      --fail-on blocker
# GitLab CI
- name: Audit SQL migrations
  run: |
    deltascope audit \
      --file ./migrations.sql \
      --format gitlab-codequality \
      --fail-on warning

What DeltaScope is not

Frequently asked questions

Which databases does it support?
MySQL, TiDB, and PostgreSQL. Select the dialect with --dialect mysql|tidb|postgresql.
How do severity levels work?
Every finding is classified as blocker (must fix, will cause data loss or downtime), warning (should fix, potential risk), or notice (informational, worth reviewing). The overall verdict is reject if any blocker is present, review if only warnings/notices, and pass if clean.
Can I use it with AI coding tools?
Yes. The MCP server integrates with Claude Code, Codex, Cursor, and 40+ AI agents. Add it via claude mcp add or the npx launcher.
Does it need a database connection?
No. The default mode is offline. It parses SQL text without any network access. An optional metadata-aware mode can use read-only table statistics if you provide connection details.
Can I customize which rules are blockers?
Yes. Every rule has a configurable severity. Override via a YAML config file and pass it with --config.