<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
    use Modules\Lpj\Models\JenisLampiran;

    return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('lampiran_dokumen', function (Blueprint $table) {
           $table->foreignIdFor(JenisLampiran::class)->constrained('jenis_lampiran')->onDelete('cascade')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('lampiran_dokumen', function (Blueprint $table) {
            $table->dropForeign(['jenis_lampiran_id']);
            $table->dropColumn('jenis_lampiran_id');
        });
    }
};
