import { MigrationInterface, QueryRunner } from 'typeorm'

export class AddCustomerEventEntity1703682111424 implements MigrationInterface {
	name = 'AddCustomerEventEntity1703682111424'

	public async up(queryRunner: QueryRunner): Promise<void> {
		await queryRunner.query(
			`CREATE TYPE "public"."customer_event_type_enum" AS ENUM('order_placed', 'order_requested', 'payment_request', 'waiter_requested', 'online_payment')`,
		)
		await queryRunner.query(
			`CREATE TABLE "customer_event" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "tenantId" uuid, "createdBy" uuid, "lastUpdatedAt" TIMESTAMP NOT NULL DEFAULT now(), "lastUpdatedBy" uuid, "type" "public"."customer_event_type_enum" NOT NULL, "orderId" uuid, CONSTRAINT "PK_cea68868c24effeb82f6a6968c1" PRIMARY KEY ("id"))`,
		)
	}

	public async down(queryRunner: QueryRunner): Promise<void> {
		await queryRunner.query(`DROP TABLE "customer_event"`)
		await queryRunner.query(`DROP TYPE "public"."customer_event_type_enum"`)
	}
}
