<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('sps', function (Blueprint $table) {
            $table->increments('id_sp');
            $table->integer('id_siswa')->unsigned();
            $table->string('hari');
            $table->date('tanggal');
            $table->time('waktu');
            $table->enum('jenis_sp', ['SP1', 'SP2', 'SP3']);
            $table->text('permasalahan');
            $table->string('nomor_surat')->nullable();
            $table->foreign('id_siswa')->references('id_siswa')->on('siswas')->onDelete('cascade')->onUpdate('cascade');
            $table->timestamps();
        });
    }

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