<?php

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

class CreatePropertyRoomPricingTypeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("
              CREATE TABLE `property_room_pricing_type` (
              `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
              `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
              `language_key` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
              `code` varchar(5) COLLATE utf8mb4_unicode_ci 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
            );

        ") ;

        DB::statement("INSERT INTO `property_room_pricing_type` VALUES
                                (1,'Per Person',NULL,NULL,1,1,1,1,1),
                                (2,'Per Room',NULL,NULL,1,1,1,1,1);");
    }

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