<?php

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

class CreateLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('operation')->index();
            $table->string('type')->index()->nullable();
            $table->string('operator')->nullable();
            $table->string('ip')->nullable();
            $table->longText('description')->nullable();
            $table->bigInteger('id_user')->index()->nullable();
            $table->timestamps();
            $table->timestamp('created_at')->index()->nullable()->change();
        });
    }

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