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 and file types so that custom tooling can read and manipulate migration history and snapshots directly.
§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.HistoryFile/HistoryFileMigration— read and write the TOML history that tracks which migrations exist.SnapshotFile— 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.
- History
File - A TOML-serializable record of all migrations that have been generated.
- History
File Migration - A single entry in the migration history.
- 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.
- Snapshot
File - A TOML-serializable snapshot of the database schema at a point in time.
- 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.