From da4553b43d895588d8eacc0f3a0f777db6662af6 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Wed, 4 Dec 2024 15:25:17 -0500 Subject: [PATCH] Gate .esdl warning (#1422) --- src/migrations/create.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/migrations/create.rs b/src/migrations/create.rs index b3865d54..fafe945e 100644 --- a/src/migrations/create.rs +++ b/src/migrations/create.rs @@ -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; @@ -272,6 +272,7 @@ async fn gen_start_migration(ctx: &Context) -> anyhow::Result<(String, SourceMap }; let mut paths: Vec = 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(); @@ -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 {