diff --git a/core/api/src/migrations/20240201124500-location-migration-2.ts b/core/api/src/migrations/20240201124500-location-migration-2.ts new file mode 100644 index 0000000000..fc2184c7ca --- /dev/null +++ b/core/api/src/migrations/20240201124500-location-migration-2.ts @@ -0,0 +1,26 @@ +/* eslint @typescript-eslint/ban-ts-comment: "off" */ +// @ts-nocheck + +async function migrateAccounts(db, batchSize = 100) { + db.collection("accounts") + .updateMany( + {}, + { + $unset: { title: "", coordinates: "" }, + }, + ) + .then((result) => { + console.log(`Processed ${result.modifiedCount} accounts`) + }) + .catch((err) => { + console.error("Error updating documents: ", err) + }) +} + +module.exports = { + async up(db) { + console.log("Begin migration removal of title/location") + await migrateAccounts(db) + console.log("Migration completed removal of title/location") + }, +}