<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('students', function (Blueprint $table) {
            $table->id();
            $table->string('student_id')->unique();          // STU-001
            $table->string('name');
            $table->string('father_name')->nullable();
            $table->string('home_phone', 20)->nullable();
            $table->string('phone', 20)->nullable();
            $table->enum('status', ['Active', 'Inactive'])->default('Active');
            $table->foreignId('course_id')->nullable()->constrained()->nullOnDelete();
            $table->foreignId('batch_id')->nullable()->constrained()->nullOnDelete();
            $table->string('photo')->nullable();             // stored path
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('students');
    }
};
