<?php

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

class CreateFindHostelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
    	if(!Schema::connection('find_hostel')->hasTable('find_histories')) {
		    Schema::connection( 'find_hostel' )->create( 'find_histories', function ( Blueprint $table ) {
			    $table->increments( 'id' );
			    $table->integer( 'user_id' )->nullable();
			    $table->string( 'province_id' )->nullable();
			    $table->string( 'district_id' )->nullable();
			    $table->bigInteger( 'min_price' )->nullable();
			    $table->bigInteger( 'max_price' )->nullable();
			    $table->tinyInteger( 'type' )->nullable();
			    $table->timestamps();
		    } );
	    }
    }

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