use DB::init function instead of manual connection and migration

This commit is contained in:
Akulij 2025-04-27 21:04:34 +03:00
parent 09f7e76d96
commit b318e3ec8e

View File

@ -74,8 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = Config::init_from_env()?;
let bot = Bot::new(&config.bot_token);
let mut db = DB::new(&config.db_url).await;
db.migrate().await.unwrap();
let mut db = DB::init(&config.db_url).await;
let db_url2 = config.db_url.clone();
let state_mgr = MongodbStorage::open(&db_url2, "gongbot", Json).await?;