fix(core/database): skip insertion / deletion if no invites need to be corrected

This commit is contained in:
Paul Makles
2024-06-04 18:46:11 +01:00
parent c59aad43c8
commit a5d0cdf0dd

View File

@@ -1051,6 +1051,7 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
}) })
.collect::<Vec<Invite>>(); .collect::<Vec<Invite>>();
if !invites.is_empty() {
db.db() db.db()
.collection("channel_invites") .collection("channel_invites")
.insert_many(invites, None) .insert_many(invites, None)
@@ -1068,6 +1069,7 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
.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`.