Expand description
A library for building Toasty command-line tools.
toasty-cli provides ToastyCli, a ready-made CLI runner that wraps a
toasty::Db handle and exposes database migration subcommands (generate,
apply, drop, reset, snapshot). It uses clap for argument parsing and
dialoguer for interactive prompts.
The crate also exposes the underlying configuration used by the command
runner. Reusable migration history, snapshot, and generation types live in
toasty::migration.
§Main types
ToastyCli— parses CLI arguments and dispatches to the appropriate migration subcommand.Config/MigrationConfig— configure migration paths, prefix styles, and checksum behavior. Loaded from aToasty.tomlfile or built programmatically.toasty::migration::History/toasty::migration::HistoryEntry— read and write the TOML history that tracks which migrations exist.toasty::migration::Snapshot— read and write schema snapshot TOML files.
§Examples
ⓘ
use toasty_cli::ToastyCli;
let db = toasty::Db::builder("sqlite::memory:").build().await?;
let cli = ToastyCli::new(db);
cli.parse_and_run().await?;Structs§
- Apply
Command - Applies pending migrations to the database.
- Config
- Configuration for Toasty CLI operations.
- Drop
Command - Removes a migration from the history and deletes its files on disk.
- Generate
Command - Generates a new SQL migration from the current schema diff.
- Migration
Command - Top-level
migrationsubcommand. - Migration
Config - Configuration for migration operations.
- Reset
Command - Drops all tables in the database, then optionally re-applies migrations.
- Snapshot
Command - Prints the current schema as a TOML snapshot to stdout.
- Toasty
Cli - A CLI runner that dispatches migration subcommands against a
Db.
Enums§
- Migration
Prefix Style - Controls the prefix format used when naming generated migration files.