mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 14:40:38 +01:00
Add missing db indexes
This commit is contained in:
parent
a5fbc94182
commit
7c7419ab1c
1 changed files with 37 additions and 1 deletions
|
@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
|
|||
import { RowDataPacket } from 'mysql2';
|
||||
|
||||
class DatabaseMigration {
|
||||
private static currentVersion = 83;
|
||||
private static currentVersion = 84;
|
||||
private queryTimeout = 3600_000;
|
||||
private statisticsAddedIndexed = false;
|
||||
private uniqueLogs: string[] = [];
|
||||
|
@ -710,6 +710,42 @@ class DatabaseMigration {
|
|||
await this.$executeQuery('ALTER TABLE `blocks` ADD first_seen datetime(6) DEFAULT NULL');
|
||||
await this.updateToSchemaVersion(83);
|
||||
}
|
||||
|
||||
if (databaseSchemaVersion < 84 && isBitcoin === true) {
|
||||
// pools
|
||||
await this.$executeQuery('ALTER TABLE `pools` ADD INDEX `slug` (`slug`)');
|
||||
await this.$executeQuery('ALTER TABLE `pools` ADD INDEX `unique_id` (`unique_id`)');
|
||||
|
||||
// lightning channels
|
||||
await this.$executeQuery('ALTER TABLE `channels` ADD INDEX `created` (`created`)');
|
||||
await this.$executeQuery('ALTER TABLE `channels` ADD INDEX `capacity` (`capacity`)');
|
||||
await this.$executeQuery('ALTER TABLE `channels` ADD INDEX `closing_reason` (`closing_reason`)');
|
||||
await this.$executeQuery('ALTER TABLE `channels` ADD INDEX `closing_resolved` (`closing_resolved`)');
|
||||
|
||||
// lightning nodes
|
||||
await this.$executeQuery('ALTER TABLE `nodes` ADD INDEX `status` (`status`)');
|
||||
await this.$executeQuery('ALTER TABLE `nodes` ADD INDEX `channels` (`channels`)');
|
||||
await this.$executeQuery('ALTER TABLE `nodes` ADD INDEX `country_id` (`country_id`)');
|
||||
await this.$executeQuery('ALTER TABLE `nodes` ADD INDEX `as_number` (`as_number`)');
|
||||
await this.$executeQuery('ALTER TABLE `nodes` ADD INDEX `first_seen` (`first_seen`)');
|
||||
|
||||
// lightning nodes sockets
|
||||
await this.$executeQuery('ALTER TABLE `nodes_sockets` ADD INDEX `type` (`type`)');
|
||||
|
||||
// lightning stats
|
||||
await this.$executeQuery('ALTER TABLE `lightning_stats` ADD INDEX `added` (`added`)');
|
||||
|
||||
// geonames
|
||||
await this.$executeQuery('ALTER TABLE `geo_names` ADD INDEX `names` (`names`)');
|
||||
|
||||
// hashrates
|
||||
await this.$executeQuery('ALTER TABLE `hashrates` ADD INDEX `type` (`type`)');
|
||||
|
||||
// audits
|
||||
await this.$executeQuery('ALTER TABLE `blocks_audits` ADD INDEX `time` (`time`)');
|
||||
|
||||
await this.updateToSchemaVersion(84);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue