Skip to content

Commit

Permalink
Gate .esdl warning (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix authored Dec 4, 2024
1 parent 99f8ace commit da4553b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/migrations/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use crate::migrations::prompt;
use crate::migrations::source_map::{Builder, SourceMap};
use crate::migrations::squash;
use crate::migrations::timeout;
use crate::platform::{is_schema_file, tmp_file_name};
use crate::platform::{is_legacy_schema_file, is_schema_file, tmp_file_name};
use crate::print;
use crate::print::style::Styler;
use crate::question;
Expand Down Expand Up @@ -272,6 +272,7 @@ async fn gen_start_migration(ctx: &Context) -> anyhow::Result<(String, SourceMap
};

let mut paths: Vec<PathBuf> = Vec::new();
let mut has_legacy_paths: bool = false;
while let Some(item) = dir.next_entry().await? {
let fname = item.file_name();
let lossy_name = fname.to_string_lossy();
Expand All @@ -280,9 +281,18 @@ async fn gen_start_migration(ctx: &Context) -> anyhow::Result<(String, SourceMap
&& item.file_type().await?.is_file()
{
paths.push(item.path());
if cfg!(feature = "gel") && is_legacy_schema_file(&lossy_name) {
has_legacy_paths = true;
}
}
}

if cfg!(feature = "gel") && has_legacy_paths {
print::warn!(
"Legacy schema file extension '.esdl' detected. Consider renaming them to '.gel'."
);
}

paths.sort();

for path in paths {
Expand Down

0 comments on commit da4553b

Please sign in to comment.