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)
```
This commit is contained in:
Eric Semeniuc 2020-10-22 12:17:14 -07:00 committed by Ryan Leckey
parent 5b7f3ab0e3
commit abb71120f0

View File

@ -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")
}};
}