mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 14:34:19 +00:00
Add a warning if there were no queries found
This commit is contained in:
parent
47d566f5b6
commit
c0dd364e58
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,7 @@ use std::process::Command;
|
|||
use std::str::FromStr;
|
||||
use std::time::SystemTime;
|
||||
use std::{env, fs};
|
||||
use console::style;
|
||||
|
||||
type QueryData = BTreeMap<String, serde_json::Value>;
|
||||
type JsonObject = serde_json::Map<String, serde_json::Value>;
|
||||
|
@ -22,6 +23,11 @@ pub fn run(url: &str, cargo_args: Vec<String>) -> anyhow::Result<()> {
|
|||
let db_kind = get_db_kind(url)?;
|
||||
let data = run_prepare_step(cargo_args)?;
|
||||
|
||||
if data.is_empty() {
|
||||
println!("{} no queries found; do you have the `offline` feature enabled",
|
||||
style("warning:").yellow());
|
||||
}
|
||||
|
||||
serde_json::to_writer_pretty(
|
||||
File::create("sqlx-data.json").context("failed to create/open `sqlx-data.json`")?,
|
||||
&DataFile { db: db_kind, data },
|
||||
|
|
Loading…
Reference in a new issue