<?php

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

class PropertyWebMenuAddAliasColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement('
        ALTER TABLE `property_web_menu`
ADD COLUMN `alias` varchar(128) NULL AFTER `route`;
        ');

        DB::statement("UPDATE `property_web_menu` SET `alias` = 'Home' WHERE `id` = 1");
        DB::statement("UPDATE `property_web_menu` SET `alias` = 'About' WHERE `id` = 2");
        DB::statement("UPDATE `property_web_menu` SET `alias` = 'Gallery' WHERE `id` = 3");
        DB::statement("UPDATE `property_web_menu` SET `alias` = 'Rooms' WHERE `id` = 4");
        DB::statement("UPDATE `property_web_menu` SET `alias` = 'Booking' WHERE `id` = 5");
        DB::statement("UPDATE `property_web_menu` SET `alias` = 'Contact' WHERE `id` = 6");

        DB::statement("
        ALTER TABLE `property_web_menu`
ADD UNIQUE INDEX(`alias`);
        ") ;

    }

}
