From abb71120f055fe4bc3637b155fa45648d45934f5 Mon Sep 17 00:00:00 2001 From: Eric Semeniuc <3838856+esemeniuc@users.noreply.github.com> Date: Thu, 22 Oct 2020 12:17:14 -0700 Subject: [PATCH] Fixes migration macro with no params Fixes issue experienced in https://github.com/launchbadge/sqlx/issues/746 when using no parameter: ``` error: paths relative to the current file's directory are not currently supported --> src/db.rs:7:5 | 7 | sqlx::migrate!().run(&conn).await?; | ^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- src/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index c165a952..5b843dca 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -604,7 +604,7 @@ macro_rules! query_file_as_unchecked ( /// ```rust,ignore /// use sqlx::migrate::Migrator; /// -/// static MIGRATOR: Migrator = sqlx::migrate!(); // defaults to "migrations" +/// static MIGRATOR: Migrator = sqlx::migrate!(); // defaults to "./migrations" /// ``` /// /// The directory must be relative to the project root (the directory containing `Cargo.toml`), @@ -618,6 +618,6 @@ macro_rules! migrate { }}; () => {{ - $crate::sqlx_macros::migrate!("migrations") + $crate::sqlx_macros::migrate!("./migrations") }}; }