<?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('file_attachments', function (Blueprint $table) {

            $table->id();

            $table->foreignId('file_id')
                ->nullable()
                ->constrained('files');

            $table->foreignId('notice_update_id')
                ->nullable()
                ->constrained('notice_updates');

            $table->string('file_name');

            $table->string('doc_name');

            $table->string('doc_type')->nullable();

            $table->integer('doc_size')->nullable();

            $table->unsignedBigInteger('created_by')->foreignId('users')->nullable();

            $table->unsignedBigInteger('updated_by')->foreignId('users')->nullable();

            $table->boolean('active')->default(true);
            $table->timestamps();
        });
    }

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