/*
  Warnings:

  - You are about to drop the column `jurusan` on the `siswa` table. All the data in the column will be lost.

*/
-- AlterTable
ALTER TABLE "siswa" DROP COLUMN "jurusan",
ADD COLUMN     "jurusanId" TEXT;

-- CreateTable
CREATE TABLE "jurusan" (
    "id" TEXT NOT NULL,
    "no" SERIAL NOT NULL,
    "kodeJurusan" TEXT NOT NULL,
    "namaJurusan" TEXT NOT NULL,
    "jenjang" TEXT NOT NULL,
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "jurusan_no_key" ON "jurusan"("no");

-- CreateIndex
CREATE UNIQUE INDEX "jurusan_kodeJurusan_key" ON "jurusan"("kodeJurusan");

-- AddForeignKey
ALTER TABLE "siswa" ADD CONSTRAINT "siswa_jurusanId_fkey" FOREIGN KEY ("jurusanId") REFERENCES "jurusan"("id") ON DELETE SET NULL ON UPDATE CASCADE;
