Fix db version conflicts

This commit is contained in:
natsoni
2024-03-13 11:09:30 +01:00
34 changed files with 488 additions and 607 deletions

View File

@@ -7,7 +7,7 @@ import cpfpRepository from '../repositories/CpfpRepository';
import { RowDataPacket } from 'mysql2';
class DatabaseMigration {
private static currentVersion = 74;
private static currentVersion = 75;
private queryTimeout = 3600_000;
private statisticsAddedIndexed = false;
private uniqueLogs: string[] = [];
@@ -620,7 +620,12 @@ class DatabaseMigration {
await this.updateToSchemaVersion(73);
}
if (databaseSchemaVersion < 74) {
if (databaseSchemaVersion < 74 && config.MEMPOOL.NETWORK === 'mainnet') {
await this.$executeQuery(`INSERT INTO state(name, number) VALUE ('last_acceleration_block', 0);`);
await this.updateToSchemaVersion(74);
}
if (databaseSchemaVersion < 75) {
await this.$executeQuery('ALTER TABLE `prices` ADD `BGN` float DEFAULT "-1"');
await this.$executeQuery('ALTER TABLE `prices` ADD `BRL` float DEFAULT "-1"');
await this.$executeQuery('ALTER TABLE `prices` ADD `CNY` float DEFAULT "-1"');
@@ -647,7 +652,7 @@ class DatabaseMigration {
await this.$executeQuery('ALTER TABLE `prices` ADD `THB` float DEFAULT "-1"');
await this.$executeQuery('ALTER TABLE `prices` ADD `TRY` float DEFAULT "-1"');
await this.$executeQuery('ALTER TABLE `prices` ADD `ZAR` float DEFAULT "-1"');
await this.updateToSchemaVersion(74);
await this.updateToSchemaVersion(75);
}
}