<?php

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

return new class extends Migration
{

    public function up()
    {
        Schema::create('mitigation_event_queue', function (Blueprint $table) {
            $table->id();

            $table->timestamps();

            $table->timestamp('started_at')->nullable();
            $table->timestamp('finished_at')->nullable();

            $table->string('type')->nullable();
            $table->string('description')->nullable();

            $table->ipAddress('destination')->nullable();

            $table->foreignId('appliance_id')->cascadeOnDelete()->constrained('goliath_appliances');

            $table->timestamp('processed_at')->nullable();
        });
    }

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