Make sure to set avg_hashrate field to double unsigned
This commit is contained in:
		
							parent
							
								
									ab486bfe6e
								
							
						
					
					
						commit
						bec3f214b5
					
				@ -6,7 +6,7 @@ import logger from '../logger';
 | 
				
			|||||||
const sleep = (ms: number) => new Promise(res => setTimeout(res, ms));
 | 
					const sleep = (ms: number) => new Promise(res => setTimeout(res, ms));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DatabaseMigration {
 | 
					class DatabaseMigration {
 | 
				
			||||||
  private static currentVersion = 14;
 | 
					  private static currentVersion = 15;
 | 
				
			||||||
  private queryTimeout = 120000;
 | 
					  private queryTimeout = 120000;
 | 
				
			||||||
  private statisticsAddedIndexed = false;
 | 
					  private statisticsAddedIndexed = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -175,6 +175,12 @@ class DatabaseMigration {
 | 
				
			|||||||
        await this.$executeQuery(connection, 'ALTER TABLE `hashrates` MODIFY `pool_id` SMALLINT UNSIGNED NOT NULL DEFAULT "0"');
 | 
					        await this.$executeQuery(connection, 'ALTER TABLE `hashrates` MODIFY `pool_id` SMALLINT UNSIGNED NOT NULL DEFAULT "0"');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (databaseSchemaVersion < 15 && isBitcoin === true) {
 | 
				
			||||||
 | 
					        logger.warn(`'hashrates' table has been truncated. Re-indexing from scratch.`);
 | 
				
			||||||
 | 
					        await this.$executeQuery(connection, 'TRUNCATE hashrates;'); // Need to re-index
 | 
				
			||||||
 | 
					        await this.$executeQuery(connection, 'ALTER TABLE `hashrates` MODIFY `avg_hashrate` DOUBLE UNSIGNED NOT NULL DEFAULT "0"');
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      connection.release();
 | 
					      connection.release();
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
      connection.release();
 | 
					      connection.release();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user