move migrations out of globals service
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
1f1e2d547c
commit
ba1c134689
5 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
||||||
mod data;
|
mod data;
|
||||||
pub(super) mod migrations;
|
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use conduit::{
|
||||||
warn, Config, Result,
|
warn, Config, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{globals, Services};
|
use crate::{migrations, Services};
|
||||||
|
|
||||||
/// Migrates a media directory from legacy base64 file names to sha2 file names.
|
/// 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
|
/// 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
|
// 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.
|
// 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)?;
|
services.globals.db.bump_database_version(13)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#![allow(refining_impl_trait)]
|
#![allow(refining_impl_trait)]
|
||||||
|
|
||||||
mod manager;
|
mod manager;
|
||||||
|
mod migrations;
|
||||||
mod service;
|
mod service;
|
||||||
pub mod services;
|
pub mod services;
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ impl Services {
|
||||||
debug_info!("Starting services...");
|
debug_info!("Starting services...");
|
||||||
|
|
||||||
self.admin.set_services(Some(Arc::clone(self)).as_ref());
|
self.admin.set_services(Some(Arc::clone(self)).as_ref());
|
||||||
globals::migrations::migrations(self).await?;
|
super::migrations::migrations(self).await?;
|
||||||
self.manager
|
self.manager
|
||||||
.lock()
|
.lock()
|
||||||
.await
|
.await
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue