import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "vip_codes" ADD "discount_value" numeric`,
    );
    await queryRunner.query(
      `ALTER TABLE "vip_codes" ALTER COLUMN "discount" DROP NOT NULL`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "vip_codes" ALTER COLUMN "discount" SET NOT NULL`,
    );
    await queryRunner.query(
      `ALTER TABLE "vip_codes" DROP COLUMN "discount_value"`,
    );
  }
}
