Data and databases · Edition No. 33 · 27 Sep 2026

sqldef/sqldef

Four command-line tools that keep one file describing the database you want and apply exactly the difference against the live one.

← Data and databasesRead the whole edition →

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.

Stars3,171
LicenceMIT, 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)
Latestv3.11.24 (2026-09-25), read from /releases/latest and confirmed by ungh and pkg.go.dev
Good
  • Safe by default where it matters most. The documentation states "By default, DROP operations are skipped (safe mode)"; deleting anything requires --enable-drop explicitly.
  • One small self-contained program per database, with nothing to install underneath it, and --dry-run and --check make 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.
Watch for
  • 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-run first, and read what it prints.
  • There is no go install line 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.md sits 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.
Similar repositories
Install
# 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
Screenshots
sqldef/sqldef: GitHub preview cardsqldef/sqldef: Screenshot 1

Get the next edition in your inbox

A dozen repositories, opened and checked. The licence read, the last release dated, and the ones that did not make it named with the reason. It is the half most lists leave out.

No tracking pixels. One click to leave. The archive stays free either way.

We use your address to send the edition and nothing else. Confirm by email, leave in one click. How we handle it.