<?php

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

class CreateAttachTaskTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        
        Schema::create('attach_task', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('attachment_id')->nullable()->unsigned();
            $table->integer('task_id')->nullable()->unsigned();
            $table->integer('active')->nullable()->default(1);
            $table->foreign('task_id')->references('id')->on('tasks')->onDelete('set null');
            $table->foreign('attachment_id')->references('id')->on('attachments')->onDelete('set null');

        });

    }

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