<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCurriculumsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('curriculums', function (Blueprint $table) {
            $table->id(); // Auto incrementing primary key
            $table->foreignId('campus_id')->constrained('campuses')->onDelete('cascade'); // Foreign key to campuses
            $table->foreignId('jurusan_id')->constrained('jurusan')->onDelete('cascade'); // Foreign key to jurusan

            $table->string('semester'); // Semester of the curriculum (e.g., Semester I, Semester II)
            $table->json('courses'); // Store the courses as a JSON array

            $table->timestamps(); // Created at and Updated at
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('curriculums');
    }
}
