<?php

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

class CreatePropertyCancellationPolicyTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("

            CREATE TABLE `property_cancellation_policy` (
              `id` bigint(10) unsigned NOT NULL AUTO_INCREMENT,
              `property_id` int(10) unsigned NOT NULL,
              `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
              `before_arrival` int(10) unsigned NOT 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 (`property_id`) REFERENCES `property` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
              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
            ) ;

        ") ;
    }

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