This commit is contained in:
Alex Holliday committed 2026-01-26 23:21:49 +00:00
1 parent f9c85e2d76
commit 716479c5bb
1 file changed
+2 -6
@@ -43,10 +43,7 @@ const backupAndDropExistingCollection = async () => {
}
const backupExists = await db.listCollections({ name: BACKUP_COLLECTION }).toArray();
if (backupExists.length > 0) {
throw new Error(
`Backup collection "${BACKUP_COLLECTION}" already exists. ` +
`Please remove it manually before running migration.`
);
throw new Error(`Backup collection "${BACKUP_COLLECTION}" already exists. ` + `Please remove it manually before running migration.`);
}
await db
@@ -142,7 +139,6 @@ const migrateBackupData = async (backedUp: boolean): Promise<MigrationStats> =>
continue;
}
const { _id, monitorId, teamId, type, ...rest } = doc;
const metadata = { monitorId, teamId, type };
operations.push({ insertOne: { document: { ...rest, metadata } } });
@@ -182,7 +178,7 @@ export const convertChecksToTimeSeries = async () => {
const stats = await migrateBackupData(backedUp);
console.log(
`Migration completed: ${stats.totalMigrated} documents migrated, ` +
`${stats.totalFailed} documents failed (stored in ${FAILED_DOCS_COLLECTION})`
`${stats.totalFailed} documents failed (stored in ${FAILED_DOCS_COLLECTION})`
);
}
};