import { MigrationInterface, QueryRunner } from 'typeorm';

export class UpdateTableTransaction1720767689625 implements MigrationInterface {
  name = 'UpdateTableTransaction1720767689625';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "transaction_items" ADD "qty_remaining" integer`,
    );
    await queryRunner.query(`ALTER TABLE "transaction_items" ADD "taxes" json`);
    await queryRunner.query(
      `ALTER TABLE "transactions" ADD "payment_total_dpp" numeric`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "transactions" DROP COLUMN "payment_total_dpp"`,
    );
    await queryRunner.query(
      `ALTER TABLE "transaction_items" DROP COLUMN "taxes"`,
    );
    await queryRunner.query(
      `ALTER TABLE "transaction_items" DROP COLUMN "qty_remaining"`,
    );
  }
}
