import { MigrationInterface, QueryRunner } from 'typeorm'; export class AddPageUpdateHistoryEntity1651972722597 implements MigrationInterface { name = 'AddPageUpdateHistoryEntity1651972722597'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query( `CREATE TABLE "page_update_history" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "price" double precision, "pageId" uuid NOT NULL, CONSTRAINT "PK_28a14c161b7b04c6b2bff8c0b76" PRIMARY KEY ("id"))` ); await queryRunner.query( `ALTER TABLE "page_update_history" ADD CONSTRAINT "FK_f381bf7992f760d209995b4f3cc" FOREIGN KEY ("pageId") REFERENCES "pages"("id") ON DELETE NO ACTION ON UPDATE NO ACTION` ); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query( `ALTER TABLE "page_update_history" DROP CONSTRAINT "FK_f381bf7992f760d209995b4f3cc"` ); await queryRunner.query(`DROP TABLE "page_update_history"`); } }