<?php

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

class CreateAttachSubtaskTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {

        Schema::create('attach_subtask', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('attachment_id')->nullable()->unsigned();
            $table->integer('subtask_id')->nullable()->unsigned();
            $table->integer('active')->nullable()->default(1);
            $table->foreign('subtask_id')->references('id')->on('subtasks')->onDelete('set null');
            $table->foreign('attachment_id')->references('id')->on('attachments')->onDelete('set null');

        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists($this->set_schema_table);
    }
}
