diff --git a/server/src/db/migration/0008_backfillMonitorLastEvaluatedAt.ts b/server/src/db/migration/0008_backfillMonitorLastEvaluatedAt.ts index 8f8de7308..3ab52f581 100644 --- a/server/src/db/migration/0008_backfillMonitorLastEvaluatedAt.ts +++ b/server/src/db/migration/0008_backfillMonitorLastEvaluatedAt.ts @@ -3,6 +3,8 @@ import { logger } from "@/utils/logger.js"; /** * Backfill lastEvaluatedAt on monitors created before the lastEvaluatedAt existed. + * + * Stamp the upgrade moment, not 0. If set to 0, all checks will be replayed */ export async function backfillMonitorLastEvaluatedAt(): Promise { const SERVICE_NAME = "Migration:BackfillMonitorLastEvaluatedAt"; @@ -10,7 +12,7 @@ export async function backfillMonitorLastEvaluatedAt(): Promise { try { logger.info({ service: SERVICE_NAME, message: "Starting lastEvaluatedAt backfill" }); - const result = await MonitorModel.updateMany({ lastEvaluatedAt: { $exists: false } }, { $set: { lastEvaluatedAt: 0 } }); + const result = await MonitorModel.updateMany({ lastEvaluatedAt: { $exists: false } }, { $set: { lastEvaluatedAt: Date.now() } }); logger.info({ service: SERVICE_NAME,