# Diff live database schemas against declarative SQL before schema drift reaches production with sqldef

> Compare checked-in SQL against live MySQL, PostgreSQL, SQLite, or SQL Server schemas and generate a reviewable apply plan before agents touch production databases.

- Skill: `agentskillexchange/diff-live-database-schemas-against-declarative-sql-before-sc` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/diff-live-database-schemas-against-declarative-sql-before-sc`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/diff-live-database-schemas-against-declarative-sql-before-sc/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/diff-live-database-schemas-against-declarative-sql-before-sc

---


# Diff live database schemas against declarative SQL before schema drift reaches production with sqldef

Compare checked-in SQL against live MySQL, PostgreSQL, SQLite, or SQL Server schemas and generate a reviewable apply plan before agents touch production databases.

## Prerequisites

Go-built sqldef binary and access to a supported relational database

## Installation

Use the upstream install or setup path that matches your environment:
- Docker images are available on Docker Hub:
- brew install sqldef/sqldef/mysqldef
- brew install sqldef/sqldef/psqldef
- brew install sqldef/sqldef/sqlite3def

Requirements and caveats from upstream:
- ### Docker images
- https://hub.docker.com/u/sqldef
- Debian packages are not currently available. Use the pre-built binaries or Docker images instead.

Basic usage or getting-started notes:
- Each database gets its own command (mysqldef, psqldef, sqlite3def, mssqldef) that mimics the connection options of the native database client, making it familiar and easy to integrate into existing workflows. The tool...
- ### Basic Workflow
- This is the basic workflow, which is identical across all databases - only the connection options differ between commands.

- Source: https://github.com/sqldef/sqldef
- Extracted from upstream docs: https://raw.githubusercontent.com/sqldef/sqldef/HEAD/README.md

## Documentation

- https://github.com/sqldef/sqldef

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/diff-live-database-schemas-against-declarative-sql-before-schema-drift-reaches-production-with-sqldef/)

