mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-13 21:17:05 +00:00
20 lines
421 B
Rust
20 lines
421 B
Rust
use super::get_connection;
|
|
|
|
pub mod init;
|
|
pub mod scripts;
|
|
|
|
pub async fn run_migrations() {
|
|
let client = get_connection();
|
|
|
|
let list = client
|
|
.list_database_names(None, None)
|
|
.await
|
|
.expect("Failed to fetch database names.");
|
|
|
|
if list.iter().position(|x| x == "revolt").is_none() {
|
|
init::create_database().await;
|
|
} else {
|
|
scripts::migrate_database().await;
|
|
}
|
|
}
|