<?php

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

class CreateModulosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('modulos', function (Blueprint $table) {
            $table->id();
            $table->integer('numeromodulo')->nullable();
            $table->integer('quantidadecelulas')->nullable();
            $table->foreignId('configuracaomodulos_id');
            $table->foreignId('corredor_id');
            $table->foreignId('usuario_id');

            $table->foreign('configuracaomodulos_id')->references('id')->on('configuracaomodulos');
            $table->foreign('usuario_id')->references('id')->on('users');
            $table->foreign('corredor_id')->references('id')->on('corredores');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('modulos', function(Blueprint $table)
        {
            $table->dropSoftDeletes();
        });
        Schema::dropIfExists('modulos');
    }
}
