fix migration
This commit is contained in:
1 parent
a7d9bb822e
commit
7ce6068757
1 file changed
+3
-1
@@ -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<void> {
|
||||
const SERVICE_NAME = "Migration:BackfillMonitorLastEvaluatedAt";
|
||||
@@ -10,7 +12,7 @@ export async function backfillMonitorLastEvaluatedAt(): Promise<void> {
|
||||
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,
|
||||
|
||||
Reference in new issue
Block a user