Centralize durable schema migration ownership
This commit is contained in:
parent
cc328237f4
commit
069f3813ae
3 changed files with 354 additions and 350 deletions
|
|
@ -291,22 +291,7 @@ fn admission_service(
|
|||
}
|
||||
|
||||
async fn migrate_all(pool: &PgPool) -> Result<(), RuntimeError> {
|
||||
remora_durable::migrate(pool).await.map_err(runtime_error)?;
|
||||
remora_identity::migrate(pool)
|
||||
.await
|
||||
.map_err(runtime_error)?;
|
||||
remora_credentials::migrate(pool)
|
||||
.await
|
||||
.map_err(runtime_error)?;
|
||||
remora_admission::migrate(pool)
|
||||
.await
|
||||
.map_err(runtime_error)?;
|
||||
remora_attempt::migrate(pool).await.map_err(runtime_error)?;
|
||||
remora_result::migrate(pool).await.map_err(runtime_error)?;
|
||||
remora_deletion::migrate(pool)
|
||||
.await
|
||||
.map_err(runtime_error)?;
|
||||
crate::migrate(pool).await.map_err(runtime_error)
|
||||
remora_schema::migrate(pool).await.map_err(runtime_error)
|
||||
}
|
||||
|
||||
fn start_maintenance(
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
mod application;
|
||||
mod migrate;
|
||||
mod public;
|
||||
mod worker;
|
||||
|
||||
pub use application::{ApiApplication, ApiApplicationConfig};
|
||||
pub use migrate::{migrate, migrator};
|
||||
pub use public::{
|
||||
PublicApiConfig, PublicApiServices, PublicApiState, configure_public_api,
|
||||
prune_live_event_history,
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
use remora_durable::DurableError;
|
||||
use sqlx::PgPool;
|
||||
|
||||
const MIGRATION_TABLE: &str = "_remora_api_migrations";
|
||||
|
||||
pub async fn migrate(pool: &PgPool) -> Result<(), DurableError> {
|
||||
let mut migrator = sqlx::migrate!("./migrations");
|
||||
migrator.dangerous_set_table_name(MIGRATION_TABLE);
|
||||
migrator.run(pool).await.map_err(DurableError::from)
|
||||
}
|
||||
|
||||
pub fn migrator() -> sqlx::migrate::Migrator {
|
||||
let mut migrator = sqlx::migrate!("./migrations");
|
||||
migrator.dangerous_set_table_name(MIGRATION_TABLE);
|
||||
migrator
|
||||
}
|
||||
Loading…
Reference in a new issue