<?php

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

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

        DB::statement("SET FOREIGN_KEY_CHECKS = 0");
        DB::statement("TRUNCATE TABLE property_channel_room_rate_pricing_policy_adult_mapping");
        DB::statement("TRUNCATE TABLE property_pricing_policy_adult");
        DB::statement("SET FOREIGN_KEY_CHECKS = 1");

        DB::statement("
ALTER TABLE `property_pricing_policy_adult`
DROP COLUMN `single_extra_type`,
DROP COLUMN `single_extra_value`,
DROP COLUMN `single_discount_type`,
DROP COLUMN `single_discount_value`,
ADD COLUMN `action_type` varchar(10)  NOT NULL COMMENT 'EXT,DIS' AFTER `name`,
ADD COLUMN `type` varchar(10) NOT NULL COMMENT 'PER,FIX' AFTER `action_type`,
ADD COLUMN `value` double(10, 2) NOT NULL AFTER `type`;
        ");
    }

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