<?php

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

class AddColumntypeIndexCreatedType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('logs', function (Blueprint $table) {
            $table->enum('type',['log','warning','error','panic','fatal'])->default('log');
            $table->index(['created_at','type'],'index_logs_c_t');
            $table->index(['created_at','class'],'index_logs_c_c');
            $table->index(['id_user','created_at'],'index_logs_i_c');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('logs', function (Blueprint $table) {
            $table->dropColumn('type');
            $table->dropIndex('index_logs_c_t');
            $table->dropIndex('index_logs_c_c');
            $table->dropIndex('index_logs_i_c');
        });
    }
}
