Macro sqlx::migrate [−][src]
macro_rules! migrate { ($dir:literal) => { ... }; () => { ... }; }
Expand description
Embeds migrations into the binary by expanding to a static instance of Migrator.
ⓘ
sqlx::migrate!("db/migrations") .run(&pool) .await?;
ⓘ
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.