<?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('tugas', function (Blueprint $table) {
            $table->id('id_tugas');
            $table->unsignedBigInteger('id_mengajar');
            $table->string('judul_tugas', 200);
            $table->text('keterangan')->nullable();
            $table->datetime('deadline');
            $table->timestamps();

            $table->foreign('id_mengajar')
                  ->references('id_mengajar')
                  ->on('mengajars')
                  ->onDelete('cascade');
        });
    }

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