Create stacked pools historical hashrates to see dominance over time

This commit is contained in:
nymkappa
2022-02-24 16:55:18 +09:00
parent a214c5ca20
commit 78fa3e33cd
16 changed files with 485 additions and 38 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 = 7;
private static currentVersion = 8;
private queryTimeout = 120000;
private statisticsAddedIndexed = false;
@@ -122,6 +122,14 @@ class DatabaseMigration {
await this.$executeQuery(connection, this.getCreateDailyStatsTableQuery(), await this.$checkIfTableExists('hashrates'));
}
if (databaseSchemaVersion < 8 && isBitcoin === true) {
await this.$executeQuery(connection, 'TRUNCATE hashrates;');
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` DROP INDEX `PRIMARY`');
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` ADD `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST');
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` ADD `share` float NOT NULL DEFAULT "0"');
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` ADD `type` enum("daily", "weekly") DEFAULT "daily"');
}
connection.release();
} catch (e) {
connection.release();