-- CreateEnum
CREATE TYPE "ExamType" AS ENUM ('ASSESSMENT', 'FIRST_TERM', 'TEST_SERIES', 'PRE_BOARD', 'FINAL_BOARD');

-- AlterTable
ALTER TABLE "Exam" ADD COLUMN     "type" "ExamType" NOT NULL DEFAULT 'ASSESSMENT';

-- AlterTable
ALTER TABLE "Grade" ADD COLUMN     "sectionGroupId" INTEGER;

-- CreateTable
CREATE TABLE "SectionGroup" (
    "id" SERIAL NOT NULL,
    "name" TEXT NOT NULL,
    "sportsTeacherId" TEXT,

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

-- CreateIndex
CREATE UNIQUE INDEX "SectionGroup_name_key" ON "SectionGroup"("name");

-- AddForeignKey
ALTER TABLE "SectionGroup" ADD CONSTRAINT "SectionGroup_sportsTeacherId_fkey" FOREIGN KEY ("sportsTeacherId") REFERENCES "Teacher"("id") ON DELETE SET NULL ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Grade" ADD CONSTRAINT "Grade_sectionGroupId_fkey" FOREIGN KEY ("sectionGroupId") REFERENCES "SectionGroup"("id") ON DELETE SET NULL ON UPDATE CASCADE;
