Compare commits

..

No commits in common. "6f24d9221585e8cf7869b15225b0e611249365c6" and "85f16311fa440e3ad4be343978c86e79ceed856f" have entirely different histories.

View File

@ -122,12 +122,6 @@ impl DB {
} }
pub async fn migrate(&mut self) -> DbResult<()> { pub async fn migrate(&mut self) -> DbResult<()> {
let db = self.get_database().await;
/// some migrations doesn't realy need type of collection
type AnyCollection = Event;
db.collection::<AnyCollection>("events")
.drop_indexes()
.await?;
let events = self.get_database().await.collection::<Event>("events"); let events = self.get_database().await.collection::<Event>("events");
events events
.create_index( .create_index(
@ -138,15 +132,12 @@ impl DB {
) )
.await?; .await?;
db.collection::<AnyCollection>("events")
.drop_indexes()
.await?;
// clear callbacks after a day because otherwise database will contain so much data // clear callbacks after a day because otherwise database will contain so much data
// for just button clicks // for just button clicks
let callback_info = self let callback_info = self
.get_database() .get_database()
.await .await
.collection::<AnyCollection>("callback_info"); .collection::<Event>("callback_info");
callback_info callback_info
.create_index( .create_index(
IndexModel::builder() IndexModel::builder()