<?php

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

class CreateConfiguracaomodulosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('configuracaomodulos', function (Blueprint $table) {
            $table->id();
            $table->float('alturamodulom',8,2)->nullable();;
            $table->float('alturamodulocm',8,2)->nullable();;
            $table->float('larguramodulom',8,2)->nullable();;
            $table->float('larguramodulocm',8,2)->nullable();;
            $table->foreignId('base_id');
            $table->foreignId('usuario_id');
            $table->softDeletes();
            $table->foreign('usuario_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
            $table->foreign('base_id')->references('id')->on('basesgestdocs')->onDelete('cascade')->onUpdate('cascade');
            $table->timestamps();
        });
    }

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