<?php

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

class CreateSearchTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('table_user', function (Blueprint $table) {
            $table->boolean('is_suggested')->default(false);
            $table->integer('suggested_position')->default(0);

            $table->integer('search_position')->default(0);

            $table->index('is_suggested');
            $table->index('suggested_position');

            $table->index('search_position');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('table_user', function (Blueprint $table) {
            $table->dropColumn('is_suggested');
            $table->dropColumn('suggested_position');

            $table->dropColumn('search_position');

            $table->dropIndex('is_suggested');
            $table->dropIndex('suggested_position');

            $table->dropIndex('search_position');
        });
    }
}
