All files / src/Projection/migrations 1691042603934-tokens-quantity-numeric.ts

80% Statements 4/5
100% Branches 0/0
50% Functions 1/2
80% Lines 4/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  35x   35x 35x     1x              
import { MigrationInterface, QueryRunner } from 'typeorm';
import { TokensEntity } from '@cardano-sdk/projection-typeorm';
 
export class TokensQuantityNumericMigrations1691042603934 implements MigrationInterface {
  static entity = TokensEntity;
 
  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query('ALTER TABLE "tokens" ALTER COLUMN "quantity" TYPE numeric(20,0) USING quantity::numeric');
  }
 
  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query('ALTER TABLE "tokens" ALTER COLUMN "quantity" TYPE bigint USING quantity::bigint');
  }
}