import { MigrationInterface, QueryRunner } from "typeorm"

export class AddVehicleManufactures1747047478233 implements MigrationInterface {
  name = "AddVehicleManufactures1747047478233"

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE TABLE "vehicle_manufactures" ("id" SERIAL NOT NULL, "name" character varying NOT NULL, "status" smallint NOT NULL DEFAULT '1', "created_at" TIMESTAMP DEFAULT NOW(), "updated_at" TIMESTAMP DEFAULT NOW(), "deleted_at" TIMESTAMP, CONSTRAINT "PK_f6a4adf4577cd51fab84c1c3671" PRIMARY KEY ("id"))`,
    )
    await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "status"`)
    await queryRunner.query(
      `ALTER TABLE "users" ADD "status" character varying`,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "status"`)
    await queryRunner.query(`ALTER TABLE "users" ADD "status" smallint`)
    await queryRunner.query(`DROP TABLE "vehicle_manufactures"`)
  }
}
