<?php

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

class AddPropertyIdToPropertyRoomRateChannelMapping extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("
        ALTER TABLE `property_room_rate_channel_mapping`
        ADD COLUMN `property_id` int(0) UNSIGNED NOT NULL AFTER `id`;
        ");

        DB::statement("
        UPDATE `property_room_rate_channel_mapping` set `property_id` = 1;
        ");

        DB::statement("
ALTER TABLE `property_room_rate_channel_mapping`
ADD FOREIGN KEY (`property_id`) REFERENCES `property` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
        ");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */

}
