KeiSeiKit-1.0/_primitives/_rust/kei-migrate/src/cli.rs
Parfii-bot 0be354a920 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

44 lines
1.2 KiB
Rust

//! CLI surface — clap argument parsing for `kei-migrate`.
use clap::{Parser, Subcommand};
#[derive(Parser, Debug)]
#[command(
name = "kei-migrate",
about = "Universal SQL migration runner (Postgres / SQLite / MySQL)",
version
)]
pub struct Cli {
/// Database URL. Overrides $DATABASE_URL.
/// Formats:
/// postgres://user:pass@host:port/db
/// sqlite:///absolute/path.db or sqlite::memory:
/// mysql://user:pass@host:port/db
#[arg(long, env = "DATABASE_URL")]
pub database_url: String,
/// Migrations directory (default: ./migrations)
#[arg(long, default_value = "migrations")]
pub dir: String,
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Apply all pending migrations.
Up,
/// Revert the last N migrations (requires <ts>_<name>.down.sql).
Down {
#[arg(default_value_t = 1)]
n: u32,
},
/// List applied vs pending migrations.
Status,
/// Create a new timestamped migration scaffold: <ts>_<name>.sql (+ .down.sql).
Create {
/// Short migration name, e.g. "add_users_email_index".
name: String,
},
}