#迁移 #diesel #async

过程宏 diesel_async_migrations_macros

为diesel_async提供的迁移功能

1个不稳定版本

0.12.0 2024年1月16日

#123#diesel

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

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