fix(core/database): skip insertion / deletion if no invites need to be corrected
This commit is contained in:
@@ -1051,22 +1051,24 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
|
|||||||
})
|
})
|
||||||
.collect::<Vec<Invite>>();
|
.collect::<Vec<Invite>>();
|
||||||
|
|
||||||
db.db()
|
if !invites.is_empty() {
|
||||||
.collection("channel_invites")
|
db.db()
|
||||||
.insert_many(invites, None)
|
.collection("channel_invites")
|
||||||
.await
|
.insert_many(invites, None)
|
||||||
.expect("failed to insert corrected invite");
|
.await
|
||||||
|
.expect("failed to insert corrected invite");
|
||||||
|
|
||||||
db.db()
|
db.db()
|
||||||
.collection::<Outer>("channel_invites")
|
.collection::<Outer>("channel_invites")
|
||||||
.delete_many(
|
.delete_many(
|
||||||
doc! {
|
doc! {
|
||||||
"type": { "$exists": false }
|
"type": { "$exists": false }
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.expect("failed to find invites");
|
.expect("failed to find invites");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to migrate fields on attachments, change `user_id`, `object_id`, etc to `parent`.
|
// Need to migrate fields on attachments, change `user_id`, `object_id`, etc to `parent`.
|
||||||
|
|||||||
Reference in New Issue
Block a user