import { MigrationInterface , QueryRunner } from "typeorm" ; export class Report1605754615028 implements MigrationInterface { name = 'Report1605754615028' ; public async up ( queryRunner ) { await queryRunner . query ( `CREATE TABLE "report" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "reporterId" uuid NOT NULL, "targetId" uuid NOT NULL, "message" text NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), CONSTRAINT "PK_99e4d0bea58cba73c57f935a546" PRIMARY KEY ("id"))` ) ; await queryRunner . query ( `COMMENT ON COLUMN "user"."codeImgIds" IS NULL` ) ; await queryRunner . query ( `ALTER TABLE "user" ALTER COLUMN "codeImgIds" SET DEFAULT '{}'::text[]` ) ; await queryRunner . query ( `ALTER TABLE "report" ADD CONSTRAINT "FK_253163ca85b927f62596606f6cc" FOREIGN KEY ("reporterId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION` ) ; await queryRunner . query ( `ALTER TABLE "report" ADD CONSTRAINT "FK_ffd71df5fd9dd53ddfa2b7cb305" FOREIGN KEY ("targetId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION` ) ; } public async down ( queryRunner ) { await queryRunner . query ( `ALTER TABLE "report" DROP CONSTRAINT "FK_ffd71df5fd9dd53ddfa2b7cb305"` ) ; await queryRunner . query ( `ALTER TABLE "report" DROP CONSTRAINT "FK_253163ca85b927f62596606f6cc"` ) ; await queryRunner . query ( `ALTER TABLE "user" ALTER COLUMN "codeImgIds" SET DEFAULT '{}'` ) ; await queryRunner . query ( `COMMENT ON COLUMN "user"."codeImgIds" IS NULL` ) ; await queryRunner . query ( `DROP TABLE "report"` ) ; } }