import { MigrationInterface, QueryRunner } from 'typeorm';

export class ItemCategory1718005501425 implements MigrationInterface {
  name = 'ItemCategory1718005501425';

  public async up(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(
      `CREATE TYPE "public"."item_categories_status_enum" AS ENUM('active', 'cancel', 'confirmed', 'draft', 'expired', 'inactive', 'pending', 'refunded', 'rejected', 'settled', 'waiting')`,
    );
    await queryRunner.query(
      `CREATE TYPE "public"."item_categories_item_type_enum" AS ENUM('tiket masuk', 'wahana', 'bundling', 'free gift')`,
    );
    await queryRunner.query(
      `CREATE TABLE "item_categories" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "creator_id" character varying(36), "creator_name" character varying(125), "editor_id" character varying(36), "editor_name" character varying(125), "created_at" bigint NOT NULL, "updated_at" bigint NOT NULL, "status" "public"."item_categories_status_enum" NOT NULL DEFAULT 'draft', "name" character varying NOT NULL, "item_type" "public"."item_categories_item_type_enum" NOT NULL DEFAULT 'tiket masuk', CONSTRAINT "PK_db3359595abacbe15cf2f89c07e" PRIMARY KEY ("id"))`,
    );
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    await queryRunner.query(`DROP TABLE "item_categories"`);
    await queryRunner.query(
      `DROP TYPE "public"."item_categories_item_type_enum"`,
    );
    await queryRunner.query(`DROP TYPE "public"."item_categories_status_enum"`);
  }
}
