Skip to content

Commit

Permalink
Fixes migration macro with no params
Browse files Browse the repository at this point in the history
Fixes issue experienced in launchbadge#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)
```
  • Loading branch information
esemeniuc authored Oct 22, 2020
1 parent 5b7f3ab commit 5d9067b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`),
Expand All @@ -618,6 +618,6 @@ macro_rules! migrate {
}};

() => {{
$crate::sqlx_macros::migrate!("migrations")
$crate::sqlx_macros::migrate!("./migrations")
}};
}

0 comments on commit 5d9067b

Please sign in to comment.