Run daily stats at midnight and backfill first launch

This commit is contained in:
softsimon committed 2022-07-11 14:45:25 +02:00
1 parent 764a12cf4d
commit 739e677c5b
2 files changed
+207 -222

No files matched your search

+7 -1
View File
@@ -4,7 +4,7 @@ import logger from '../logger';
import { Common } from './common';
class DatabaseMigration {
private static currentVersion = 27;
private static currentVersion = 28;
private queryTimeout = 120000;
private statisticsAddedIndexed = false;
private uniqueLogs: string[] = [];
@@ -274,6 +274,12 @@ class DatabaseMigration {
await this.$executeQuery('ALTER TABLE `lightning_stats` ADD med_base_fee_mtokens bigint(20) unsigned NOT NULL DEFAULT "0"');
}
if (databaseSchemaVersion < 28 && isBitcoin === true) {
await this.$executeQuery(`TRUNCATE lightning_stats`);
await this.$executeQuery(`TRUNCATE node_stats`);
await this.$executeQuery(`ALTER TABLE lightning_stats MODIFY added DATE`);
}
} catch (e) {
throw e;
}