cd ..
sqlite-schema-diff(1)Mizuchi Labs Manualsqlite-schema-diff(1)
mizuchi:~$man sqlite-schema-diff

NAME

sqlite-schema-diff

A schema-first approach to SQLite migrations.

★ 2 · last pushed 2026-10-31

DESCRIPTION

sqlite-schema-diff takes a schema-first approach to SQLite migrations. You define your schema in .sql files and the tool works out what changed.

Define the desired schema, diff it against your database to preview the changes, then apply them automatically. No numbered migration files and no merge conflicts, just SQL.

Apply is built to protect your data. It creates a backup through VACUUM INTO, runs every statement in a single transaction, and rolls back instead of committing a foreign key violation. Destructive changes are flagged and prompt for confirmation.

The tool is under active development, so always back up your database before applying changes. It works as a CLI and as a Go library.

FEATURES

  • Diff your database against .sql schema files and preview changes
  • Automatic apply inside a single transaction started with BEGIN IMMEDIATE
  • Backup through VACUUM INTO before anything is touched
  • Destructive changes flagged with confirmation prompts
  • Covers tables, indexes, views, and triggers
  • Raw SQL output for diffs with the --sql flag
  • Usable as a Go library alongside the CLI

QUICK START

CLI
# Preview changes
sqlite-schema-diff diff --database app.db --schema ./schema

# Apply changes
sqlite-schema-diff apply --database app.db --schema ./schema
Install
go install github.com/mizuchilabs/sqlite-schema-diff@latest
Dump
sqlite-schema-diff dump --database app.db --output ./schema

CONFIGURATION

NameDescription
--databaseDatabase file to compare. Used by diff, apply, and dump.
--schemaDirectory of .sql schema files.
--sqlOutput raw SQL from diff.
--dry-runShow what would happen without applying.
--forceSkip confirmation for destructive changes.
--skip-destructiveSkip destructive changes.
--backup=falseDisable automatic backup.

RELATED

LINKS

GitHub[github]https://github.com/mizuchilabs/sqlite-schema-diff
SELF-HOSTED VS COMMERCIAL

Self-hosting sqlite-schema-diff is free under the Apache-2.0 license. Run it on your own iron. Commercial licensing, support, and managed offerings for businesses are on the business page.