<?php

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

class CreateTraceDocumentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('trace_documents', function (Blueprint $table) {
            $table->id('id_tracedocument');
            $table->unsignedBigInteger('fk_tracetype');
            $table->foreign('fk_tracetype')->references('id_tracetype')->on('trace_types');
            $table->unsignedBigInteger('fk_document');
            $table->foreign('fk_document')->references('id_document')->on('documents');
            $table->unsignedBigInteger('fk_user');
            $table->foreign('fk_user')->references('id_user')->on('usuarios');
            $table->timestamps();
        });
    }

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