move migrations out of globals service

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-11-01 22:16:14 +00:00
parent 1f1e2d547c
commit ba1c134689
5 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,4 @@
mod data;
pub(super) mod migrations;
use std::{
collections::HashMap,

View file

@ -13,7 +13,7 @@ use conduit::{
warn, Config, Result,
};
use crate::{globals, Services};
use crate::{migrations, Services};
/// Migrates a media directory from legacy base64 file names to sha2 file names.
/// All errors are fatal. Upon success the database is keyed to not perform this
@ -50,7 +50,7 @@ pub(crate) async fn migrate_sha256_media(services: &Services) -> Result<()> {
// Apply fix from when sha256_media was backward-incompat and bumped the schema
// version from 13 to 14. For users satisfying these conditions we can go back.
if services.globals.db.database_version().await == 14 && globals::migrations::DATABASE_VERSION == 13 {
if services.globals.db.database_version().await == 14 && migrations::DATABASE_VERSION == 13 {
services.globals.db.bump_database_version(13)?;
}

View file

@ -1,6 +1,7 @@
#![allow(refining_impl_trait)]
mod manager;
mod migrations;
mod service;
pub mod services;

View file

@ -114,7 +114,7 @@ impl Services {
debug_info!("Starting services...");
self.admin.set_services(Some(Arc::clone(self)).as_ref());
globals::migrations::migrations(self).await?;
super::migrations::migrations(self).await?;
self.manager
.lock()
.await