<?php

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

class CreatePropertyChannelBookingPaymentSetupTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("
            CREATE TABLE `property_channel_booking_payment_setup` (
              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
              `property_id` int(10) unsigned NOT NULL,
              `channel_id` int(10) unsigned NOT NULL,
              `payment_type_id` int(10) unsigned NOT NULL,
              `action_type` varchar(100) DEFAULT NULL COMMENT 'PLS, MIN',
              `value_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'FIX, PER',
              `value` double(10,2) DEFAULT NULL,
              `is_selected` tinyint(3) DEFAULT NULL,
              `status` tinyint(3) unsigned NOT NULL DEFAULT 1,
              `created_by` int(10) unsigned NOT NULL,
              `updated_by` int(10) unsigned NOT NULL,
              `created_at` int(11) NOT NULL,
              `updated_at` int(11) NOT NULL,
              PRIMARY KEY (`id`),
              FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
              FOREIGN KEY (`updated_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
              FOREIGN KEY (`property_id`) REFERENCES `property` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
              FOREIGN KEY (`channel_id`) REFERENCES `property_channel` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
              FOREIGN KEY (`payment_type_id`) REFERENCES `property_booking_payment_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
                );

        ") ;
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('property_channel_booking_payment_setup');
    }
}
