<?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('student_documents', function (Blueprint $table) {
            $table->id();
            $table->branchColumn();
            $table->foreignId('student_id')->constrained('students')->cascadeOnDelete();
            $table->string('type', 60);              // birth_certificate, b_form, cnic, ...
            $table->string('title')->nullable();
            $table->string('path');
            $table->string('mime', 100)->nullable();
            $table->unsignedInteger('size')->nullable();
            $table->auditColumns();
            $table->timestamps();
        });
    }

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