[][src]Macro sqlx::migrate

macro_rules! migrate {
    ($dir:literal) => { ... };
    () => { ... };
}

Embeds migrations into the binary by expanding to a static instance of Migrator.

ⓘThis example is not tested
sqlx::migrate!("db/migrations")
    .run(&pool)
    .await?;
ⓘThis example is not tested
use sqlx::migrate::Migrator;

static MIGRATOR: Migrator = sqlx::migrate!(); // defaults to "migrations"

The directory must be relative to the project root (the directory containing Cargo.toml), unlike include_str!() which uses compiler internals to get the path of the file where it was invoked.