<?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('materi', function (Blueprint $table) {
            $table->bigIncrements('id_materi');
            $table->string('judul_materi', 100)->nullable(false);
            $table->string('lampiran_materi', 100)->nullable();
            $table->text('keterangan')->nullable();
            $table->unsignedBigInteger('id_mapel');
            $table->timestamps();

            $table->foreign('id_mapel')->references('id_mapel')->on('mata_pelajaran')->onDelete('cascade');


        });
    }

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