export class CallBlocking1783151000000 {
    name = "CallBlocking1783151000000";
    async up(queryRunner) {
        await queryRunner.query(`CREATE TABLE "call_blocking" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "blockeeId" character varying(32) NOT NULL, "blockerId" character varying(32) NOT NULL, CONSTRAINT "PK_call_blocking_id" PRIMARY KEY ("id"))`);
        await queryRunner.query(`CREATE INDEX "IDX_call_blocking_createdAt" ON "call_blocking" ("createdAt")`);
        await queryRunner.query(`CREATE INDEX "IDX_call_blocking_blockeeId" ON "call_blocking" ("blockeeId")`);
        await queryRunner.query(`CREATE INDEX "IDX_call_blocking_blockerId" ON "call_blocking" ("blockerId")`);
        await queryRunner.query(`CREATE UNIQUE INDEX "IDX_call_blocking_blocker_blockee" ON "call_blocking" ("blockerId", "blockeeId")`);
        await queryRunner.query(`ALTER TABLE "call_blocking" ADD CONSTRAINT "FK_call_blocking_blockee" FOREIGN KEY ("blockeeId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
        await queryRunner.query(`ALTER TABLE "call_blocking" ADD CONSTRAINT "FK_call_blocking_blocker" FOREIGN KEY ("blockerId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
    }
    async down(queryRunner) {
        await queryRunner.query(`ALTER TABLE "call_blocking" DROP CONSTRAINT "FK_call_blocking_blocker"`);
        await queryRunner.query(`ALTER TABLE "call_blocking" DROP CONSTRAINT "FK_call_blocking_blockee"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_call_blocking_blocker_blockee"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_call_blocking_blockerId"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_call_blocking_blockeeId"`);
        await queryRunner.query(`DROP INDEX "public"."IDX_call_blocking_createdAt"`);
        await queryRunner.query(`DROP TABLE "call_blocking"`);
    }
}
