import { MigrationInterface, QueryRunner } from "typeorm"

export class AddTimestampInInsectionAnswerOptions1762347018395 implements MigrationInterface {
  name = "AddTimestampInInsectionAnswerOptions1762347018395"

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" ADD "created_at" TIMESTAMP NOT NULL DEFAULT NOW()`,
    )
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" ADD "updated_at" TIMESTAMP NOT NULL DEFAULT NOW()`,
    )
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" ADD "deleted_at" TIMESTAMP`,
    )
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" DROP COLUMN "deleted_at"`,
    )
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" DROP COLUMN "updated_at"`,
    )
    await queryRunner.query(
      `ALTER TABLE "inspection_answer_options" DROP COLUMN "created_at"`,
    )
  }
}
