* Refactor `ConnectionTrait` * Refactoring * Build index & foreign key statements * Fix imports * Fixup * Rocket example with migration * async-std compatible with the tokio 1.0 runtime * Use reexported dependency * Compile without selecting any db backend * Updating sea-orm-cli dep * sea-orm-cli migrate commands * cargo fmt * Test [cli] * Refactoring * Clap app name should be "sea-orm-cli" * Correctly capture MIGRATION_DIR * Rename README * Add `sea-orm-cli migrate init` command * Update README * Try restructured sea-query dependency (SeaQL/sea-schema#41) * Set `DATABASE_URL` environment variable
19 lines
578 B
Rust
19 lines
578 B
Rust
use migration::Migrator;
|
|
use sea_schema::migration::*;
|
|
|
|
#[async_std::main]
|
|
async fn main() {
|
|
// Setting `DATABASE_URL` environment variable
|
|
let key = "DATABASE_URL";
|
|
if std::env::var(key).is_err() {
|
|
// Getting the database URL from Rocket.toml if it's not set
|
|
let figment = rocket::Config::figment();
|
|
let database_url: String = figment
|
|
.extract_inner("databases.sea_orm.url")
|
|
.expect("Cannot find Database URL in Rocket.toml");
|
|
std::env::set_var(key, database_url);
|
|
}
|
|
|
|
cli::run_cli(Migrator).await;
|
|
}
|