import { MigrationInterface, QueryRunner } from "typeorm"

export class AddCityStateCountryInFleetManagement1749469603860 implements MigrationInterface {
  name = "AddCityStateCountryInFleetManagement1749469603860"

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`ALTER TABLE "fleet_operations" ADD "city" integer`)
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" ADD "country" character varying`,
    )
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" DROP COLUMN "state"`,
    )
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" ADD "state" character varying`,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" DROP COLUMN "state"`,
    )
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" ADD "state" integer NOT NULL`,
    )
    await queryRunner.query(
      `ALTER TABLE "fleet_operations" DROP COLUMN "country"`,
    )
    await queryRunner.query(`ALTER TABLE "fleet_operations" DROP COLUMN "city"`)
  }
}
