KeiSeiKit-1.0/_primitives/_rust/kei-migrate/Cargo.toml
Parfii-bot df857923d4 feat(primitives): kei-migrate Rust universal migration runner
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>
2026-04-21 20:35:29 +08:00

28 lines
681 B
TOML

[package]
name = "kei-migrate"
version = "0.1.0"
edition = "2021"
description = "Universal SQL migration runner — Postgres/SQLite/MySQL autodetect from DATABASE_URL"
license = "MIT"
[[bin]]
name = "kei-migrate"
path = "src/main.rs"
[dependencies]
anyhow = "1"
chrono = { version = "0.4", default-features = false, features = ["clock"] }
clap = { version = "4", features = ["derive", "env"] }
sha2 = "0.10"
sqlx = { version = "0.8", default-features = false, features = [
"runtime-tokio",
"tls-rustls",
"any",
"postgres",
"sqlite",
"mysql",
] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs"] }
[dev-dependencies]
tempfile = "3"