Truncate hashrates after #1435 - Fix hashrate indexing logs

This commit is contained in:
nymkappa
2022-03-24 07:40:03 +09:00
parent 80a103acab
commit 185dddd8c7
2 changed files with 8 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ import logger from '../logger';
const sleep = (ms: number) => new Promise(res => setTimeout(res, ms));
class DatabaseMigration {
private static currentVersion = 15;
private static currentVersion = 16;
private queryTimeout = 120000;
private statisticsAddedIndexed = false;
@@ -175,6 +175,11 @@ class DatabaseMigration {
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` MODIFY `pool_id` SMALLINT UNSIGNED NOT NULL DEFAULT "0"');
}
if (databaseSchemaVersion < 16 && isBitcoin === true) {
logger.warn(`'hashrates' table has been truncated. Re-indexing from scratch.`);
await this.$executeQuery(connection, 'TRUNCATE hashrates;'); // Need to re-index because we changed timestamps
}
connection.release();
} catch (e) {
connection.release();