# sqldef

> Idempotent schema management in plain SQL for MySQL, PostgreSQL, SQLite and SQL Server

Source: https://talira.ai/catalog/sqldef-0273hr6q
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Command-line tool
- Categories: [developer tools / database / migrations](https://talira.ai/categories/developer-tools/database/migrations), [developer tools / database / schema design](https://talira.ai/categories/developer-tools/database/schema-design)
- Licence: MIT AND Apache-2.0[^1]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source.
- Free tier: yes[^1]
- Backed by: [sqldef](https://talira.ai/orgs/sqldef.md)

A schema migration tool that keeps your whole schema in one plain SQL file: edit the file, and sqldef compares it with the live database and generates and applies the DDL to get there, from any starting state. Each database has its own command (mysqldef for MySQL, MariaDB and TiDB, psqldef, sqlite3def, mssqldef) with the native client's connection options, and each can export the current schema and preview changes with a dry run. A single binary with no dependencies, started by Takashi Kokubun and inspired by Ridgepole's Ruby DSL. MIT licensed, with its SQL parser under Apache 2.0.

## Links

- Website: https://sqldef.github.io
- GitHub: https://github.com/sqldef/sqldef

## Problems it solves

- change my database schema by editing one SQL file instead of writing migration files
- get the ALTER statements needed to make my database match a schema file
- keep schema changes idempotent so running them twice is safe

## Features

- desired-state schema migrations from a plain SQL file
- MySQL, MariaDB, TiDB, PostgreSQL, SQLite and SQL Server
- export the current schema
- dry run that shows the DDL before applying
- single binary with no dependencies

## Trust

Overall: 0.67 out of 1.
Signals: maintenance 1.00, adoption 0.70, momentum 0.46, community 0.85, backing 0.30, extensibility 0.00.

- last commit 13 days ago
- 91 commits in the last 90 days
- latest release v3.11.30 19 days ago
- 3.2k GitHub stars
- 134 contributors
- accepts sponsorship (Github)
- has a company behind it

## Alternatives

- [Atlas](https://talira.ai/catalog/atlas-vjsak9tx.md): Database schema as code: plan, lint, test and apply schema migrations, like Terraform for databases
- [pgschema](https://talira.ai/catalog/pgschema-zs6w461m.md): Terraform-style declarative schema migrations for PostgreSQL: dump, edit, plan, apply
- [Liquibase](https://talira.ai/catalog/liquibase-bkqpwkmt.md): Track, version, deploy and roll back database schema changes across 70+ databases
- [Reylo](https://talira.ai/catalog/reylo-0v2g7263.md): Import .sql files into TypeScript with types inferred from your live database, plus SQL-first migrations
- [dbmate](https://talira.ai/catalog/dbmate-q0nv00j1.md): A lightweight, framework-agnostic database migration tool for plain SQL migrations
- [goose (database migrations)](https://talira.ai/catalog/goose-database-migrations-cbmxye2d.md): Database migration tool for SQL files and Go functions

## Sources

[^1]: https://github.com/sqldef/sqldef/blob/master/LICENSE (checked 24 Nov 2026)
