sqldef
github.com
What it is
sqldef is a free command-line tool for managing relational database migrations with SQL DDLs. Users maintain a SQL file describing the desired schema; sqldef compares it with the current database schema to generate and apply changes. It lists support for MySQL, MariaDB, TiDB, PostgreSQL, SQL Server, and SQLite3. The workflow can export the current schema and use a dry run to preview migrations before execution. It can also compare two SQL files without a database connection, for schema validation, CI/CD, and migration script generation. Repeated runs are safe: when the database matches the desired schema, another run shows no changes. Rename annotations are documented for tables, columns, indexes, and ENUM values. Each database tool is distributed as a single binary without dependencies. Linux, macOS, Windows, and self-hosted availability are listed. Linux binaries and Docker images are available, but Debian packages are not; a Homebrew tap is listed for four database tools. Source files use the MIT License, while the parser uses Apache License 2.0.
Spec sheet
- Purpose
- sqldef is a CLI tool for diffing SQL schemas and managing relational database migrations with regular SQL DDLs.Read 30 Sep 2026 · sqldef.github.io
- Intended users
- The project describes sqldef as a tool for managing schema changes across supported relational databases using SQL.Read 30 Sep 2026 · sqldef.github.io
- Integrations
- The project links to Docker images on Docker Hub and a GitHub Action that previews database schema changes.Read 30 Sep 2026 · github.com
- License
- The repository says source files are distributed under the MIT License, with the parser under Apache License 2.0.Read 30 Sep 2026 · github.com
- Build and dependencies
- The project says each database tool is distributed as a single binary with no dependencies.Read 30 Sep 2026 · github.com
- Databases
- The project lists support for MySQL, MariaDB, TiDB, PostgreSQL, SQL Server, and SQLite3.Read 30 Sep 2026 · sqldef.github.io
- Declarative schemas
- Users maintain a SQL file with the complete desired schema, which sqldef compares with the current schema to generate and apply DDL changes.Read 30 Sep 2026 · github.com
- Idempotence
- The README says operations are safe to run multiple times and repeated runs show no changes when the database already matches the desired schema.Read 30 Sep 2026 · github.com
- Linux availability
- The README provides prebuilt Linux binaries and Docker images and says Debian packages are not currently available.Read 30 Sep 2026 · github.com
- macOS availability
- The README says a Homebrew tap is available for mysqldef, psqldef, sqlite3def, and mssqldef.Read 30 Sep 2026 · github.com
- Offline mode
- sqldef can compare two SQL files without connecting to a database, for schema validation, CI/CD, and migration script generation.Read 30 Sep 2026 · github.com
- Preview and export
- The command workflow includes exporting the current schema and using dry-run to preview migrations without executing them.Read 30 Sep 2026 · github.com
- Rename support
- The README documents renaming tables, columns, indexes, and ENUM values using an @renamed annotation.Read 30 Sep 2026 · github.com
- Security and provenance
- The release page marks the release commit as signed with GitHub’s verified signature and displays a release attestation asset.Read 30 Sep 2026 · github.com
- Support and community
- The README directs feature requests to pull requests or GitHub Discussions.Read 30 Sep 2026 · github.com
Plans and prices
Strong points and limits
Strong points
- Supports six listed relational databases.
- Dry-run previews migrations before execution.
- Compares SQL files without a database connection.
- Single-binary database tools have no dependencies.
Limits
- Debian packages are not currently available.
- Homebrew is listed for four database tools, not all.
- Parser uses Apache License 2.0 rather than MIT.
Who it suits
sqldef suits people managing schema changes across supported relational databases using SQL. Its offline file comparison and GitHub Action can fit validation and CI/CD workflows.
Verdict
sqldef offers a declarative SQL workflow with previews, offline comparison, and repeatable schema changes. Its database-specific installation options vary, and Debian packages are not available.
Where Specifiction places it
- Database Schema Comparison Tools#12 of 257.6