<?php

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

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

        Schema::table('logs', function (Blueprint $table) {
            $table->index('created_at','index_logs_created_at');
            $table->index(['method','created_at'],'index_logs_m_c');
            $table->index(['type','created_at'],'index_logs_t_c');
//            $table->index(['id_user','created_at'],'index_logs_i_c');
//            $table->dropIndex('index_logs_i_c');
            $table->dropIndex('index_logs_c_c');
            $table->dropIndex('index_logs_c_t');
//            $table->dropIndex('index_logs_c_m');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('logs', function (Blueprint $table) {
            $table->dropIndex('index_logs_created_at');
            $table->dropIndex('index_logs_m_c');
            $table->dropIndex('index_logs_t_c');
            $table->index(['type','created_at'],'index_logs_t_c');
            $table->index(['created_at','type'],'index_logs_c_t');
        });
    }
}
