import { MigrationInterface, QueryRunner } from "typeorm"

export class AlterCurrencyTableCoulumnName1743601446624 implements MigrationInterface {
  name = "AlterCurrencyTableCoulumnName1743601446624"

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "currencies" RENAME COLUMN "code" TO "currency_code"`,
    )
    await queryRunner.query(
      `ALTER TABLE "currencies" RENAME CONSTRAINT "UQ_9f8d0972aeeb5a2277e40332d29" TO "UQ_46b8e68b649433979094a8c50e1"`,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "currencies" RENAME CONSTRAINT "UQ_46b8e68b649433979094a8c50e1" TO "UQ_9f8d0972aeeb5a2277e40332d29"`,
    )
    await queryRunner.query(
      `ALTER TABLE "currencies" RENAME COLUMN "currency_code" TO "code"`,
    )
  }
}
