Skip to content

Commit

Permalink
[cli] skip checking connection string contains username and host (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 authored Jul 10, 2022
1 parent 65017bd commit 1fc1562
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions sea-orm-cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,8 @@ pub async fn run_generate_command(
// above
let url_username = url.username();
let url_host = url.host_str();

let is_sqlite = url.scheme() == "sqlite";

// Skip checking if it's SQLite
if !is_sqlite {
// Panic on any that are missing
if url_username.is_empty() {
panic!("No username was found in the database url");
}
if url_host.is_none() {
panic!("No host was found in the database url");
}
}

let tables = match tables {
Some(t) => t,
_ => "".to_string(),
Expand Down Expand Up @@ -461,25 +449,6 @@ mod tests {
}
}

#[test]
#[should_panic(expected = "No username was found in the database url")]
fn test_generate_entity_no_username() {
let cli = Cli::parse_from(vec![
"sea-orm-cli",
"generate",
"entity",
"--database-url",
"mysql://:root@localhost:3306/database",
]);

match cli.command {
Commands::Generate { command } => {
smol::block_on(run_generate_command(command, cli.verbose)).unwrap();
}
_ => unreachable!(),
}
}

#[test]
#[should_panic(expected = "called `Result::unwrap()` on an `Err` value: PoolTimedOut")]
fn test_generate_entity_no_password() {
Expand Down

0 comments on commit 1fc1562

Please sign in to comment.