<?php

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

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

        DB::statement("UPDATE `property_place_category` SET `order_number` = 1 WHERE `id` = 1");
        DB::statement("UPDATE `property_place_category` SET `order_number` = 2 WHERE `id` = 2");
        DB::statement("UPDATE `property_place_category` SET `order_number` = 3 WHERE `id` = 3");
        DB::statement("UPDATE `property_place_category` SET `order_number` = 4 WHERE `id` = 4");
        DB::statement("UPDATE `property_place_category` SET `order_number` = 5 WHERE `id` = 5");
        DB::statement("UPDATE `property_place_category` SET `order_number` = 6 WHERE `id` = 6");

        DB::statement("
            ALTER TABLE `property_place`
            ADD COLUMN `order_number` tinyint NULL DEFAULT NULL AFTER `reservation_requirement`;
        ");

        DB::statement("ALTER TABLE `property_web_menu_mapping` DROP FOREIGN KEY `property_web_menu_mapping_ibfk_3`;");

        DB::statement("
            ALTER TABLE `property_web_menu_mapping`
            ADD COLUMN `type` varchar(10) NULL DEFAULT 'MAIN' COMMENT 'MAIN,PLCCAT,PLC' AFTER `order_number`,
            ADD COLUMN `menu_code` varchar(10) NULL DEFAULT 'LVL1' COMMENT 'LVL1,LVL2' AFTER `type`;
        ");

    }


}
