-- CreateTable
CREATE TABLE "progress_report_update_plenary_decisions" (
    "id" SERIAL NOT NULL,
    "progress_report_update_id" INTEGER NOT NULL,
    "ministry_id" INTEGER NOT NULL,
    "plenary_decision_id" INTEGER NOT NULL,
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "deleted_at" TIMESTAMP(3),

    CONSTRAINT "progress_report_update_plenary_decisions_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "progress_report_update_plenary_decisions_progress_report_up_idx" ON "progress_report_update_plenary_decisions"("progress_report_update_id");

-- CreateIndex
CREATE INDEX "progress_report_update_plenary_decisions_plenary_decision_i_idx" ON "progress_report_update_plenary_decisions"("plenary_decision_id");

-- CreateIndex
CREATE INDEX "progress_report_update_plenary_decisions_ministry_id_idx" ON "progress_report_update_plenary_decisions"("ministry_id");

-- CreateIndex
CREATE INDEX "progress_report_update_plenary_decisions_deleted_at_idx" ON "progress_report_update_plenary_decisions"("deleted_at");

-- AddForeignKey
ALTER TABLE "progress_report_update_plenary_decisions" ADD CONSTRAINT "progress_report_update_plenary_decisions_progress_report_u_fkey" FOREIGN KEY ("progress_report_update_id") REFERENCES "progress_report_updates"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "progress_report_update_plenary_decisions" ADD CONSTRAINT "progress_report_update_plenary_decisions_ministry_id_fkey" FOREIGN KEY ("ministry_id") REFERENCES "stakeholders"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "progress_report_update_plenary_decisions" ADD CONSTRAINT "progress_report_update_plenary_decisions_plenary_decision__fkey" FOREIGN KEY ("plenary_decision_id") REFERENCES "plenary_rgc_decisions"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
