diff --git a/src/components/contract/repositories/smart-contract.repository.ts b/src/components/contract/repositories/smart-contract.repository.ts index 848e87d4..5ca646ec 100644 --- a/src/components/contract/repositories/smart-contract.repository.ts +++ b/src/components/contract/repositories/smart-contract.repository.ts @@ -174,6 +174,7 @@ export class SmartContractRepository extends Repository { sc.token_symbol AS symbol, sc.contract_address, sc.num_tokens, + sc.total_tx, IFNULL(tx_24h.no, 0) AS transfers_24h, IFNULL(tx_3d.no, 0) AS transfers_3d, uptime.timestamp AS upTime diff --git a/src/migrations/1680502133033-add-column-total-transaction.ts b/src/migrations/1680502133033-add-column-total-transaction.ts new file mode 100644 index 00000000..e9387cf5 --- /dev/null +++ b/src/migrations/1680502133033-add-column-total-transaction.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class addColumnTotalTransaction1680502133033 + implements MigrationInterface +{ + name = 'addColumnTotalTransaction1680502133033'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`smart_contracts\` ADD \`total_tx\` int NOT NULL DEFAULT 0`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`smart_contracts\` DROP COLUMN \`total_tx\``, + ); + } +} diff --git a/src/shared/entities/smart-contract.entity.ts b/src/shared/entities/smart-contract.entity.ts index 25dd698e..08893b3b 100644 --- a/src/shared/entities/smart-contract.entity.ts +++ b/src/shared/entities/smart-contract.entity.ts @@ -90,4 +90,7 @@ export class SmartContract extends BaseEntityIncrementId { @Column() decimals: number; + + @Column() + total_tx: number; }