<?php

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

class GoliathHistory extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        Schema::create('goliath_history', function (Blueprint $table) {

            $table->id();
            $table->timestamps();
    
            $table->enum('type', [ 'Flags', 'Inline', 'Firewall', 'Default', 'Ruleset', 'RulesetFull' ]);
            $table->json('history')->default('[]');

            $table->foreignId('organisation_id')->cascadeOnDelete()->nullable()->constrained('organisations');
            $table->foreignId('user_id')->cascadeOnDelete()->nullable()->constrained('users');
        });

    }

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