- Add BackupData struct and BackupService with raw SQL export/import - Restore uses raw inserts to bypass brew deductions and timeline creation - Restore requires an empty database, inserts in FK dependency order - Add comprehensive e2e test verifying full round-trip fidelity
27 lines
594 B
Rust
27 lines
594 B
Rust
use clap::Args;
|
|
|
|
#[derive(Debug, Args)]
|
|
pub struct BackupCommand {
|
|
/// Database URL to back up from
|
|
#[arg(
|
|
long,
|
|
env = "BREWLOG_DATABASE_URL",
|
|
default_value = "sqlite://brewlog.db"
|
|
)]
|
|
pub database_url: String,
|
|
}
|
|
|
|
#[derive(Debug, Args)]
|
|
pub struct RestoreCommand {
|
|
/// Database URL to restore into (must be an empty database)
|
|
#[arg(
|
|
long,
|
|
env = "BREWLOG_DATABASE_URL",
|
|
default_value = "sqlite://brewlog.db"
|
|
)]
|
|
pub database_url: String,
|
|
|
|
/// Path to the backup JSON file
|
|
#[arg(long)]
|
|
pub file: String,
|
|
}
|