-- AlterTable
ALTER TABLE "AllowedStudent" ALTER COLUMN "updatedAt" DROP DEFAULT;

-- CreateTable
CREATE TABLE "VideoCourse" (
    "id" TEXT NOT NULL,
    "videoId" TEXT NOT NULL,
    "courseId" TEXT NOT NULL,
    "exclusive" BOOLEAN NOT NULL DEFAULT true,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,

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

-- CreateIndex
CREATE INDEX "VideoCourse_courseId_idx" ON "VideoCourse"("courseId");

-- CreateIndex
CREATE INDEX "VideoCourse_videoId_idx" ON "VideoCourse"("videoId");

-- CreateIndex
CREATE UNIQUE INDEX "VideoCourse_videoId_courseId_key" ON "VideoCourse"("videoId", "courseId");

-- AddForeignKey
ALTER TABLE "VideoCourse" ADD CONSTRAINT "VideoCourse_videoId_fkey" FOREIGN KEY ("videoId") REFERENCES "Video"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "VideoCourse" ADD CONSTRAINT "VideoCourse_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
