<?php

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

class CreatePropertyFactAttributeMappingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('property_fact_attribute_mapping', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('fact_id')->unsigned();
            $table->integer('attribute_id')->unsigned();
            $table->unsignedInteger('created_by');
            $table->unsignedInteger('updated_by');
            $table->integer('created_at');
            $table->integer('updated_at');
        });

        Schema::table('property_fact_attribute_mapping',function (Blueprint $table) {
            $table->foreign('fact_id')->references('id')->on('property_fact');
            $table->foreign('attribute_id')->references('id')->on('property_fact_attribute');
        });
    }

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