<?php

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

class CreateInsumosTrasladosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('insumos_traslados', function (Blueprint $table) {
            $table->id();
            $table->string('remito', 50)->nullable();
            $table->date('fecha_remito')->nullable();
            $table->string('orden', 50)->nullable();
            $table->unsignedBigInteger('insumo_id')->nullable();
            $table->unsignedBigInteger('almacen_id')->nullable();
            $table->unsignedBigInteger('user_id')->nullable();
            $table->integer('quantity');
            $table->timestamps();

            $table->foreign('insumo_id')->references('id')->on('insumos');
            $table->foreign('almacen_id')->references('id')->on('almacenes');
        });
    }

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