remora/crates/remora-durable/src/migrate.rs

14 lines
311 B
Rust
Raw Normal View History

use sqlx::PgPool;
use crate::error::DurableError;
static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("./migrations");
pub async fn migrate(pool: &PgPool) -> Result<(), DurableError> {
MIGRATOR.run(pool).await?;
Ok(())
}
pub fn migrator() -> &'static sqlx::migrate::Migrator {
&MIGRATOR
}