<?php

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

class CreateUserAutotagTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('user_autotag', function($table) {
            $table->create();
            $table->increments('id');
            $table->integer('user_id')->nullable()->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
            $table->integer('unit_id')->nullable()->unsigned();
            $table->foreign('unit_id')->references('id')->on('units')->onDelete('set null');
            $table->integer('pipeline_id')->nullable()->unsigned();
            $table->foreign('pipeline_id')->references('id')->on('pipelines')->onDelete('set null');
            $table->integer('profile_id')->nullable()->unsigned();
            $table->foreign('profile_id')->references('id')->on('profiles')->onDelete('set null');
            $table->integer('teamrole_id')->nullable()->unsigned();
            $table->foreign('teamrole_id')->references('id')->on('teamroles')->onDelete('set null');
            $table->timestamps();
        });
    }

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

