<?php

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

    class CreateLampiranDokumenTable extends Migration
    {
        public function up()
        {
            Schema::create('lampiran_dokumen', function (Blueprint $table) {
                $table->id();
                $table->unsignedBigInteger('permohonan_id');
                $table->string('nama_file');
                $table->string('path_file');
                $table->text('keterangan')->nullable();
                $table->timestamps();
                $table->softDeletes();

                $table->unsignedBigInteger('created_by')->nullable();
                $table->unsignedBigInteger('updated_by')->nullable();
                $table->unsignedBigInteger('deleted_by')->nullable();

                $table->foreign('permohonan_id')->references('id')->on('permohonan')->onDelete('cascade');
            });
        }

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