/*
  Warnings:

  - You are about to drop the column `programme_masterId` on the `programme_feedback_question` table. All the data in the column will be lost.
  - You are about to drop the column `programme_session_masterId` on the `programme_session_feedback_question` table. All the data in the column will be lost.

*/
-- DropForeignKey
ALTER TABLE "programme_feedback_question" DROP CONSTRAINT "programme_feedback_question_programme_masterId_fkey";

-- DropForeignKey
ALTER TABLE "programme_session_feedback_question" DROP CONSTRAINT "programme_session_feedback_ques_programme_session_masterId_fkey";

-- AlterTable
ALTER TABLE "programme_feedback_question" DROP COLUMN "programme_masterId",
ADD COLUMN     "programme_master_id" TEXT;

-- AlterTable
ALTER TABLE "programme_session_feedback_question" DROP COLUMN "programme_session_masterId",
ADD COLUMN     "programme_session_master_id" TEXT;

-- AlterTable
ALTER TABLE "session_attendance" ALTER COLUMN "selfie_url" DROP NOT NULL;

-- CreateTable
CREATE TABLE "programme_master_feedback_question" (
    "id" TEXT NOT NULL,
    "programme_master_id" TEXT NOT NULL,
    "feedback_question_id" TEXT NOT NULL,
    "is_deleted" BOOLEAN NOT NULL DEFAULT false,

    PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "programme_session_master_feedback_question" (
    "id" TEXT NOT NULL,
    "programme_session_master_id" TEXT NOT NULL,
    "feedback_question_id" TEXT NOT NULL,
    "is_deleted" BOOLEAN NOT NULL DEFAULT false,

    PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "programme_feedback_question" ADD FOREIGN KEY ("programme_master_id") REFERENCES "programme_master"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "programme_session_feedback_question" ADD FOREIGN KEY ("programme_session_master_id") REFERENCES "programme_session_master"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "programme_master_feedback_question" ADD FOREIGN KEY ("programme_master_id") REFERENCES "programme_master"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "programme_master_feedback_question" ADD FOREIGN KEY ("feedback_question_id") REFERENCES "feedback_question"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "programme_session_master_feedback_question" ADD FOREIGN KEY ("programme_session_master_id") REFERENCES "programme_session_master"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "programme_session_master_feedback_question" ADD FOREIGN KEY ("feedback_question_id") REFERENCES "feedback_question"("id") ON DELETE CASCADE ON UPDATE CASCADE;
