Compare commits
2 Commits
85f16311fa
...
6f24d92215
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f24d92215 | ||
|
|
4d6717967d |
@ -122,6 +122,12 @@ 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(
|
||||||
@ -132,12 +138,15 @@ 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::<Event>("callback_info");
|
.collection::<AnyCollection>("callback_info");
|
||||||
callback_info
|
callback_info
|
||||||
.create_index(
|
.create_index(
|
||||||
IndexModel::builder()
|
IndexModel::builder()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user