<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('log_clients', function (Blueprint $blueprint) {
            $blueprint->id();
            $blueprint->unsignedBigInteger('fk_client');
            $blueprint->string('type', 30);
            $blueprint->string('old_value');
            $blueprint->string('new_value');
            $blueprint->unsignedBigInteger('fk_userupdater')->nullable();
            $blueprint->timestamp('updated_at')->useCurrent();

            $blueprint->foreign('fk_userupdater')->references('id')->on('sc_users');
        });
    }

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