<?php

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

class CreateOrdenCompraTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ordenes_de_compra', function (Blueprint $table) {
            $table->id();
            $table->string('observations', 200)->nullable();
            $table->string('status', 30)->default('pendiente');
            $table->unsignedBigInteger('insumo_id')->nullable();
            $table->unsignedBigInteger('proveedor_id')->nullable();
            $table->integer('quantity');
            $table->timestamps();

            $table->foreign('insumo_id')->references('id')->on('insumos');
            $table->foreign('proveedor_id')->references('id')->on('proveedores');
        });
    }

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