Skip to main content

Crate toasty_cli

Crate toasty_cli 

Source
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 a Toasty.toml file 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§

ApplyCommand
Applies pending migrations to the database.
Config
Configuration for Toasty CLI operations.
DropCommand
Removes a migration from the history and deletes its files on disk.
GenerateCommand
Generates a new SQL migration from the current schema diff.
HistoryFile
A TOML-serializable record of all migrations that have been generated.
HistoryFileMigration
A single entry in the migration history.
MigrationCommand
Top-level migration subcommand.
MigrationConfig
Configuration for migration operations.
ResetCommand
Drops all tables in the database, then optionally re-applies migrations.
SnapshotCommand
Prints the current schema as a TOML snapshot to stdout.
SnapshotFile
A TOML-serializable snapshot of the database schema at a point in time.
ToastyCli
A CLI runner that dispatches migration subcommands against a Db.

Enums§

MigrationPrefixStyle
Controls the prefix format used when naming generated migration files.