Count only working clients in miner report

This commit is contained in:
Ben
2026-06-20 23:54:40 -04:00
parent bed275fe7b
commit bc8eba3c49
3 changed files with 22 additions and 0 deletions
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class ActiveClientReportIndex1781311000000 implements MigrationInterface {
public name = 'ActiveClientReportIndex1781311000000';
public transaction = false;
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
CREATE INDEX CONCURRENTLY IF NOT EXISTS "IDX_client_working_report_updated_user_agent"
ON "client_entity" ("updatedAt" DESC, "userAgent")
INCLUDE ("hashRate", "bestDifficulty")
WHERE "deletedAt" IS NULL
AND "hashRate" > 0
`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX CONCURRENTLY IF EXISTS "IDX_client_working_report_updated_user_agent"`);
}
}