All files / src/Projection/migrations 1715157190230-rewards-pledge-numeric.ts

60% Statements 3/5
100% Branches 0/0
0% Functions 0/2
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  40x   40x 40x                        
import { MigrationInterface, QueryRunner } from 'typeorm';
import { PoolRewardsEntity } from '@cardano-sdk/projection-typeorm';
 
export class RewardsPledgeNumericMigration1715157190230 implements MigrationInterface {
  static entity = PoolRewardsEntity;
 
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      'ALTER TABLE "pool_rewards" ALTER COLUMN "pledge" TYPE numeric(20,0) USING pledge::numeric'
    );
  }
 
  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query('ALTER TABLE "pool_rewards" ALTER COLUMN "pledge" TYPE bigint USING pledge::bigint');
  }
}