Crates.io | diesel_async_migrations |
lib.rs | diesel_async_migrations |
version | 0.15.0 |
source | src |
created_at | 2024-01-16 10:34:14.818822 |
updated_at | 2024-09-04 15:20:03.978493 |
description | migrations for diesel_async |
homepage | |
repository | https://github.com/niroco/diesel_async_migrations |
max_upload_size | |
id | 1101492 |
size | 10,491 |
Handles Postgres migrations via async diesel
pub const MIGRATIONS: diesel_async_migrations::EmbeddedMigrations = diesel_async_migrations::embed_migrations!();
async fn run_migrations(url: impl AsRef<str>) -> anyhow::Result<()> {
let mut conn = AsyncConnection::establish(url.as_ref()).await?;
MIGRATIONS.run_pending_migrations(&mut conn).await?;
Ok(())
}
In order for Cargo to correctly pick up changes to migration directory. Add a build.rs:
fn main() {
println!("cargo:rerun-if-changed=migrations");
}