drizzle_cli/lib.rs
1//! Drizzle CLI - Command-line interface for drizzle-rs migrations
2//!
3//! This crate provides a standalone CLI tool for managing database migrations
4//! using a `drizzle.config.toml` configuration file instead of requiring Rust code.
5//!
6//! # Quick Start
7//!
8//! 1. Install the CLI with the drivers it should connect through:
9//! `cargo install drizzle-cli --locked --features sqlite-all` (or
10//! `postgres-all`, `mysql-all`, or individual driver features such as
11//! `rusqlite`). Without a driver, `migrate`, `push`, and `introspect`
12//! report "No driver available".
13//! 2. Run `drizzle init` to create a `drizzle.config.toml`
14//! 3. Run `drizzle generate` to create migrations
15//!
16//! # Configuration
17//!
18//! Create a `drizzle.config.toml` file in your project root (or run `drizzle init`):
19//!
20//! ```toml
21//! dialect = "sqlite"
22//! schema = "src/schema.rs"
23//! out = "./drizzle"
24//!
25//! [dbCredentials]
26//! url = "./dev.db"
27//! ```
28//!
29//! For `PostgreSQL`:
30//!
31//! ```toml
32//! dialect = "postgresql"
33//! schema = "src/schema.rs"
34//! out = "./drizzle"
35//!
36//! [dbCredentials]
37//! url = "postgres://user:pass@localhost:5432/mydb"
38//! ```
39//!
40//! # Commands
41//!
42//! - `drizzle init` - Create a new drizzle.config.toml configuration file
43//! - `drizzle generate` - Generate a new migration from schema changes
44//! - `drizzle generate --custom` - Create an empty migration for manual SQL
45//! - `drizzle status` - Show migration status
46//! - `drizzle migrate` - Run pending migrations (requires database connection)
47//! - `drizzle push` - Push schema directly to database (requires database connection)
48//! - `drizzle introspect` - Introspect database and generate snapshot (requires database connection)
49
50pub mod commands;
51pub mod config;
52pub mod db;
53pub mod error;
54pub mod output;
55pub mod snapshot;
56
57pub use config::{Config, Credentials, Dialect, Driver, Error};
58pub use error::CliError;