2021-05-15 15:27:40 +00:00
|
|
|
use std::env;
|
2021-05-18 14:50:49 +00:00
|
|
|
use tenebrous_dicebot::db::sqlite::migrator;
|
2021-05-15 15:27:40 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), migrator::MigrationError> {
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
let db_path: &str = match &args[..] {
|
|
|
|
[_, path] => path.as_ref(),
|
|
|
|
[_, _, ..] => panic!("Expected exactly 0 or 1 argument"),
|
|
|
|
_ => "dicebot.sqlite",
|
|
|
|
};
|
|
|
|
|
|
|
|
println!("Using database: {}", db_path);
|
|
|
|
|
|
|
|
migrator::migrate(db_path).await
|
|
|
|
}
|