<?php

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

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

        DB::statement("
                CREATE TABLE `property_language_spoken`  (
                  `id` bigint(20) NOT NULL AUTO_INCREMENT,
                  `property_id` int(10) UNSIGNED NOT NULL,
                  `language_code` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci 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`) USING BTREE,
                  INDEX `property_id`(`property_id`) USING BTREE,
                  INDEX `language_code`(`language_code`) USING BTREE,
                  INDEX `created_by`(`created_by`) USING BTREE,
                  INDEX `updated_by`(`updated_by`) USING BTREE,
                  UNIQUE INDEX `property_id_2`(`property_id`, `language_code`) USING BTREE,
                  CONSTRAINT `property_language_spoken_ibfk_1` FOREIGN KEY (`property_id`) REFERENCES `property` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                  CONSTRAINT `property_language_spoken_ibfk_2` FOREIGN KEY (`language_code`) REFERENCES `language` (`code`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                  CONSTRAINT `property_language_spoken_ibfk_3` FOREIGN KEY (`created_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
                  CONSTRAINT `property_language_spoken_ibfk_4` FOREIGN KEY (`updated_by`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
                ) ;
        ");
        DB::statement("INSERT INTO `property_additional_info_key` (`id`, `additional_info_key`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (11, 'min_check_in_age_with_elder_person', 1, 1, 1, 1, 1);");
        DB::statement("INSERT INTO `property_additional_info_key` (`id`, `additional_info_key`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (12, 'min_self_check_in_age', 1, 1, 1, 1, 1);");
        DB::statement("INSERT INTO `property_additional_info_key` (`id`, `additional_info_key`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (13, 'property_timezone', 1, 1, 1, 1, 1);");
    }

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