Single binary, three backends (Postgres/SQLite/MySQL) autodetected
from DATABASE_URL scheme. Sequential .sql migrations tracked in
_kei_migrations with SHA-256 checksums.
Commands:
kei-migrate up — apply pending
kei-migrate down [n] — revert last N (requires .down.sql)
kei-migrate status — list applied vs pending
kei-migrate create <name> — scaffold up+down pair with UTC ts
Constructor Pattern: 10 source files, all <90 LOC, functions <30 LOC.
Deps: sqlx 0.8 (any+postgres+sqlite+mysql, rustls), clap 4, chrono,
sha2, anyhow, tokio.
Tests: 9/9 passing (cargo test, SQLite backend).
Clippy clean: cargo clippy --all-targets -- -D warnings.
Safety features:
- checksum drift detection on applied migrations
- IRREVERSIBLE marker blocks down-revert
- duplicate version detection at scan time
- each migration in its own transaction
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>