<?php

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

class AddIndexSeoContent extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('seo_contents', function (Blueprint $table) {
            if (Schema::hasColumn('seo_contents', 'code')) {
                $table->index('code');
            }

            if (Schema::hasColumn('seo_contents', 'parameter_one')) {
                $table->index('parameter_one');
            }
            if (Schema::hasColumn('seo_contents', 'parameter_one')) {
                $table->string('price')->nullable()->change();
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
