import { MigrationInterface, QueryRunner } from 'typeorm';

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

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE TYPE "public"."transactions_payment_type_counter_enum" AS ENUM('midtrans', 'bank transfer', 'qris', 'counter', 'cash', 'credit card', 'debit', 'e-money')`,
    );
    await queryRunner.query(
      `ALTER TABLE "transactions" ADD "payment_type_counter" "public"."transactions_payment_type_counter_enum"`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "transactions" DROP COLUMN "payment_type_counter"`,
    );
    await queryRunner.query(
      `DROP TYPE "public"."transactions_payment_type_counter_enum"`,
    );
  }
}
