chore(monorepo): delta, january, quark
This commit is contained in:
26
crates/quark/src/impl/mongo/admin/migrations.rs
Normal file
26
crates/quark/src/impl/mongo/admin/migrations.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use crate::{AbstractMigrations, Result};
|
||||
|
||||
use super::super::MongoDb;
|
||||
|
||||
mod init;
|
||||
mod scripts;
|
||||
|
||||
#[async_trait]
|
||||
impl AbstractMigrations for MongoDb {
|
||||
async fn migrate_database(&self) -> Result<()> {
|
||||
info!("Migrating the database.");
|
||||
|
||||
let list = self
|
||||
.list_database_names(None, None)
|
||||
.await
|
||||
.expect("Failed to fetch database names.");
|
||||
|
||||
if list.iter().any(|x| x == "revolt") {
|
||||
scripts::migrate_database(self).await;
|
||||
} else {
|
||||
init::create_database(self).await;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user