Centralize durable schema migration ownership
This commit is contained in:
parent
cc328237f4
commit
069f3813ae
1 changed files with 354 additions and 350 deletions
|
|
@ -12,8 +12,6 @@ use time::OffsetDateTime;
|
|||
|
||||
use crate::WorkerError;
|
||||
|
||||
const MIGRATION_TABLE: &str = "_remora_worker_migrations";
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DescriptorStore {
|
||||
pool: PgPool,
|
||||
|
|
@ -154,17 +152,6 @@ impl DescriptorStore {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn migrate(pool: &PgPool) -> Result<(), sqlx::migrate::MigrateError> {
|
||||
migrator().run(pool).await
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn migrator() -> sqlx::migrate::Migrator {
|
||||
let mut migrator = sqlx::migrate!("./migrations");
|
||||
migrator.dangerous_set_table_name(MIGRATION_TABLE);
|
||||
migrator
|
||||
}
|
||||
|
||||
struct StoredDescriptor {
|
||||
id: OpaqueId,
|
||||
schema_version: PositiveIntegerDto,
|
||||
|
|
|
|||
Loading…
Reference in a new issue