Skip to content

Commit 8a95761

Browse files
committed
Allow to embed surql files
1 parent b7c8d44 commit 8a95761

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

refinery_core/src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ fn file_stem_re() -> &'static Regex {
2323
/// Matches the stem + extension of a SQL migration file.
2424
fn file_re_sql() -> &'static Regex {
2525
static RE: OnceLock<Regex> = OnceLock::new();
26-
RE.get_or_init(|| Regex::new([STEM_RE, r"\.sql$"].concat().as_str()).unwrap())
26+
RE.get_or_init(|| Regex::new([STEM_RE, r"\.(sql|surql)$"].concat().as_str()).unwrap())
2727
}
2828

2929
/// Matches the stem + extension of any migration file.
3030
fn file_re_all() -> &'static Regex {
3131
static RE: OnceLock<Regex> = OnceLock::new();
32-
RE.get_or_init(|| Regex::new([STEM_RE, r"\.(rs|sql)$"].concat().as_str()).unwrap())
32+
RE.get_or_init(|| Regex::new([STEM_RE, r"\.(rs|sql|surql)$"].concat().as_str()).unwrap())
3333
}
3434

3535
/// enum containing the migration types used to search for migrations

refinery_macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub fn embed_migrations(input: TokenStream) -> TokenStream {
120120
let extension = migration.extension().unwrap();
121121
migration_filenames.push(filename.clone());
122122

123-
if extension == "sql" {
123+
if extension == "sql" || extension == "surql" {
124124
_migrations.push(quote! {(#filename, include_str!(#path).to_string())});
125125
} else if extension == "rs" {
126126
let rs_content = fs::read_to_string(&path)

0 commit comments

Comments
 (0)