- check the existance of `Cargo.toml` at current working directory
  before checking 'DATABASE_URL' environment variable
This commit is contained in:
LMJW 2020-08-16 16:27:32 +10:00 committed by Ryan Leckey
parent 9b26d45344
commit 48a55a407b

View file

@ -1,7 +1,8 @@
use crate::opt::{Command, DatabaseCommand, MigrateCommand};
use anyhow::anyhow;
use anyhow::{anyhow, bail};
use dotenv::dotenv;
use std::env;
use std::path::Path;
mod database;
// mod migration;
@ -13,6 +14,13 @@ mod prepare;
pub use crate::opt::Opt;
pub async fn run(opt: Opt) -> anyhow::Result<()> {
if !Path::new("Cargo.toml").exists() {
bail!(
r#"Failed to read `Cargo.toml`.
hint: This command only works in the manifest directory of a Cargo package."#
);
}
dotenv().ok();
let database_url = match opt.database_url {