use crate::{DbPool, error::DbError};
#[cfg(all(feature = "sqlite", not(feature = "postgres")))]
#[tracing::instrument(name = "db.migrate.run", skip_all, err)]
pub async fn run_migrations(pool: &DbPool) -> Result<(), DbError> {
sqlx::migrate!("./migrations/sqlite")
.run(pool)
.await
.map_err(DbError::Migration)?;
Ok(())
}
#[cfg(feature = "postgres")]
#[tracing::instrument(name = "db.migrate.run", skip_all, err)]
pub async fn run_migrations(pool: &DbPool) -> Result<(), DbError> {
sqlx::migrate!("./migrations/postgres")
.run(pool)
.await
.map_err(DbError::Migration)?;
Ok(())
}