<?php

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

return new class extends Migration
{
    /**
     * Jalankan migration — membuat tabel siswa di database.
     */
    public function up(): void
    {
        Schema::create('siswas', function (Blueprint $table) {
            $table->id();                           // Primary key auto increment
            $table->string('nama');                 // Nama lengkap siswa
            $table->string('kelas');                // Kelas siswa (misal: X-IPA-1)
            $table->string('nisn')->unique();       // Nomor Induk Siswa Nasional
            $table->text('alamat');                 // Alamat siswa
            $table->enum('jenis_kelamin', ['Laki-laki', 'Perempuan']); // Jenis kelamin
            $table->timestamps();                   // created_at & updated_at otomatis
        });
    }

    /**
     * Rollback migration — hapus tabel siswa.
     */
    public function down(): void
    {
        Schema::dropIfExists('siswas');
    }
};