From 93cc21271f248d41a1fd9c92a9052a6f5a2e9fad Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Tue, 15 Oct 2024 00:40:46 +0800 Subject: [PATCH] wip --- ...ble-status.js => reset-migrate-aggregate-table-state.js} | 0 package.json | 2 +- server/database.js | 6 +++++- 3 files changed, 6 insertions(+), 2 deletions(-) rename extra/{reset-migrate-aggregate-table-status.js => reset-migrate-aggregate-table-state.js} (100%) diff --git a/extra/reset-migrate-aggregate-table-status.js b/extra/reset-migrate-aggregate-table-state.js similarity index 100% rename from extra/reset-migrate-aggregate-table-status.js rename to extra/reset-migrate-aggregate-table-state.js diff --git a/package.json b/package.json index 8ba835964..1e2982e18 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "quick-run-nightly": "docker run --rm --env NODE_ENV=development -p 3001:3001 louislam/uptime-kuma:nightly2", "start-dev-container": "cd docker && docker-compose -f docker-compose-dev.yml up --force-recreate", "rebase-pr-to-1.23.X": "node extra/rebase-pr.js 1.23.X", - "reset-migrate-aggregate-table-status": "node extra/reset-migrate-aggregate-table-status.js" + "reset-migrate-aggregate-table-state": "node extra/reset-migrate-aggregate-table-state.js" }, "dependencies": { "@grpc/grpc-js": "~1.8.22", diff --git a/server/database.js b/server/database.js index 4b2573150..8ff886045 100644 --- a/server/database.js +++ b/server/database.js @@ -729,8 +729,12 @@ class Database { } /** - * TODO: Migrate the old data in the heartbeat table to the new format (stat_daily, stat_hourly, stat_minutely) + * Migrate the old data in the heartbeat table to the new format (stat_daily, stat_hourly, stat_minutely) * It should be run once while upgrading V1 to V2 + * + * Normally, it should be in transaction, but UptimeCalculator wasn't designed to be in transaction before that. + * I don't want to heavily modify the UptimeCalculator, so it is not in transaction. + * Run `npm run reset-migrate-aggregate-table-state` to reset, in case the migration is interrupted. * @returns {Promise} */ static async migrateAggregateTable() {