import { MigrationInterface, QueryRunner } from "typeorm"

export class AlterStateAndCountryTableToAddIndexing1764933951210 implements MigrationInterface {
  name = "AlterStateAndCountryTableToAddIndexing1764933951210"

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE INDEX "IDX_b2d7006793e8697ab3ae2deff1" ON "countries" ("id") `,
    )
    await queryRunner.query(
      `CREATE INDEX "IDX_fa1376321185575cf2226b1491" ON "countries" ("name") `,
    )
    await queryRunner.query(
      `CREATE INDEX "IDX_09ab30ca0975c02656483265f4" ON "states" ("id") `,
    )
    await queryRunner.query(
      `CREATE INDEX "IDX_fe52f02449eaf27be2b2cb7acd" ON "states" ("name") `,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `DROP INDEX "public"."IDX_fe52f02449eaf27be2b2cb7acd"`,
    )
    await queryRunner.query(
      `DROP INDEX "public"."IDX_09ab30ca0975c02656483265f4"`,
    )
    await queryRunner.query(
      `DROP INDEX "public"."IDX_fa1376321185575cf2226b1491"`,
    )
    await queryRunner.query(
      `DROP INDEX "public"."IDX_b2d7006793e8697ab3ae2deff1"`,
    )
  }
}
