#迁移 #diesel #async

过程宏 diesel_async_migrations_macros

为diesel_async提供的迁移功能

1个不稳定版本

0.12.0 2024年1月16日

#123#diesel

Download history 11/week @ 2024-04-14 26/week @ 2024-04-21 83/week @ 2024-04-28 30/week @ 2024-05-05 26/week @ 2024-05-12 28/week @ 2024-05-19 25/week @ 2024-05-26 36/week @ 2024-06-02 78/week @ 2024-06-09 30/week @ 2024-06-16 63/week @ 2024-06-23 107/week @ 2024-06-30 144/week @ 2024-07-07 203/week @ 2024-07-14 131/week @ 2024-07-21 90/week @ 2024-07-28

593 每月下载量
2 个crate中使用 (通过 diesel_async_migrations)

MIT 许可证

10KB
203

!!! 非官方

Diesel Async Migrations

通过async diesel处理Postgres迁移

示例用法


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(())
}


Build.rs

为了使Cargo正确地获取迁移目录的更改,添加一个build.rs


fn main() {
    println!("cargo:rerun-if-changed=migrations");
}


依赖项

~79KB