mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
Add a warning if there were no queries found
This commit is contained in:
parent
47d566f5b6
commit
c0dd364e58
@ -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…
x
Reference in New Issue
Block a user