3,171 stars · MIT, read from /blob/master/LICENSE on 2026-09-27; the bundled parser/ directory is separately Apache-2.0 per parser/LICENSE.md, which adds the change-notice duty of Apache section 4(b) · v3.11.24 (2026-09-25), read from /releases/latest and confirmed by ungh and pkg.go.dev · Track this in Scout
Four command-line tools that keep one file describing the database you want and apply exactly the difference against the live one.
▶Repo detailsthe review · specs · pros & cons · install
What it is
sqldef is four command-line programs — mysqldef, psqldef, sqlite3def and mssqldef — that manage a database schema by comparison rather than by migration scripts. You keep a single file of ordinary CREATE TABLE statements; it reads the live database, compares, and generates exactly the changes required.
What it is good for. Anyone who has inherited a folder of numbered migration files and no longer trusts that running them from scratch produces the database that is actually in production. That drift is the problem this removes. --export writes the current live schema into the declarative form, so you can adopt it on an existing database in one command without changing anything. --dry-run prints the commands without running them, and --check exits with a distinct code when changes are pending, which makes it usable as an automatic gate before a deploy.
- Safe by default where it matters most. The documentation states "By default, DROP operations are skipped (safe mode)"; deleting anything requires
--enable-dropexplicitly. - One small self-contained program per database, with nothing to install underneath it, and
--dry-runand--checkmake it drop straight into an automated pipeline. - Genuinely busy. Version 3.11.24 was released on 25 September 2026, code landed on 26 September 2026, and it has been running since August 2018.
- The risk is real once you turn dropping on. With
--enable-drop, deleting a column from the description file deletes that column and its data from the live database. An accidental edit becomes an accidental deletion. Always run--dry-runfirst, and read what it prints. - There is no
go installline in the documentation. The install section lists only archives, Homebrew and containers, so the Go route has to be worked out from the module path. Building from source also needs Go 1.26, which is very new. - A file named
v4-migration.mdsits in the repository root while the released line is still 3.x, so a version with breaking changes is coming. The documentation is also scattered across files in the repository root rather than a documentation site.
- ariga/atlas
8,625 stars, a much larger tool for the same idea with schema versioning and a cloud service behind it; more capable and more to adopt.
Track this in Scout - skeema/skeema
1,374 stars, the same declarative approach for MySQL and MariaDB only, and older at it.
Track this in Scout - djrobstep/migra
3,047 stars, a PostgreSQL schema differ in Python; its own description now begins DEPRECATED and its last code landed 25 August 2025.
Track this in Scout
# Linux, for PostgreSQL wget -O - https://github.com/sqldef/sqldef/releases/latest/download/psqldef_linux_amd64.tar.gz | tar xvz # macOS brew install sqldef/sqldef/psqldef # from source, needs Go 1.26 or newer go install github.com/sqldef/sqldef/v3/cmd/psqldef@latest

