<?php

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

class DropColumnCheckinFromPropertyTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('property', function (Blueprint $table) {


            $table->dropColumn('checkin_time');
            $table->dropColumn('checkout_time');
        });

        DB::table('property_additional_info_key')->insert(
            [
                [
                    'additional_info_key' => 'checkin_time',
                    'status' => 1,
                    'created_by' => 1,
                    'updated_by' => 1,
                    'created_at' => 1,
                    'updated_at' => 1,
                ],
                [
                    'additional_info_key' => 'checkout_time',
                    'status' => 1,
                    'created_by' => 1,
                    'updated_by' => 1,
                    'created_at' => 1,
                    'updated_at' => 1,
                ]
            ]

        );

        DB::connection()->statement("UPDATE property_additional_info_key SET status = 0  WHERE additional_info_key = 'pet' ");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('property', function (Blueprint $table) {
            $table->string('checkin_time',50)->nullable();
            $table->string('checkout_time',50)->nullable();
        });
    }
}
