Skip to main content

max / goingson

419 B · 12 lines History Blame Raw
1 //! Apply pending migrations to a database file.
2 //!
3 //! Usage: `cargo run -p goingson-db-sqlite --example migrate -- <path>`
4
5 fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let path = std::env::args().nth(1).ok_or("usage: migrate <db-path>")?;
7 let db = goingson_db_sqlite::init_pool(Some(&path))?;
8 goingson_db_sqlite::run_migrations(&db)?;
9 println!("migrations applied to {path}");
10 Ok(())
11 }
12