<?php

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

class CreateProductionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('productions', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('product_id');
            $table->unsignedBigInteger('stocktransaction_id_out')->nullable();
            $table->double('product_qty');
            $table->unsignedBigInteger('product_unit')->nullable();
            $table->date('date_in')->nullable();
            $table->date('date_process')->nullable();
            $table->date('date_out')->nullable();
            $table->enum('status', [
                'draft',
                'in_progress',
                'completed',
                'cancelled'
            ])->default('draft');
            $table->timestamps();
        });
    }

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