Compare commits
2 Commits
85f16311fa
...
6f24d92215
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f24d92215 | ||
|
|
4d6717967d |
@ -122,6 +122,12 @@ impl DB {
|
||||
}
|
||||
|
||||
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");
|
||||
events
|
||||
.create_index(
|
||||
@ -132,12 +138,15 @@ impl DB {
|
||||
)
|
||||
.await?;
|
||||
|
||||
db.collection::<AnyCollection>("events")
|
||||
.drop_indexes()
|
||||
.await?;
|
||||
// clear callbacks after a day because otherwise database will contain so much data
|
||||
// for just button clicks
|
||||
let callback_info = self
|
||||
.get_database()
|
||||
.await
|
||||
.collection::<Event>("callback_info");
|
||||
.collection::<AnyCollection>("callback_info");
|
||||
callback_info
|
||||
.create_index(
|
||||
IndexModel::builder()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user