Aaron Leopold 7ba6144ead
Added axum graphql example (#587)
* added example for axum + graphql

* clean up

* removed macos file

* Pr/587 (#1)

* Migrate on startup

* Update CI

* Add .gitignore

* Add README

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>

Co-authored-by: Billy Chan <ccw.billy.123@gmail.com>
2022-03-16 18:16:19 +08:00

27 lines
569 B
Rust

use migration::Migrator;
use sea_schema::migration::*;
use std::path::PathBuf;
#[cfg(debug_assertions)]
use dotenv::dotenv;
#[async_std::main]
async fn main() {
#[cfg(debug_assertions)]
dotenv().ok();
let fallback = "sqlite:./db?mode=rwc";
match std::env::var("DATABASE_URL") {
Ok(val) => {
println!("Using DATABASE_URL: {}", val);
}
Err(_) => {
std::env::set_var("DATABASE_URL", fallback);
println!("Set DATABASE_URL: {}", fallback);
}
};
cli::run_cli(Migrator).await;
}