<?php

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

class CreateFgProducedIssuedRmTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fg_produced_issued_rm', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('production_id')->nullable()->unsigned();
            $table->foreign('production_id')->references('id')->on('production_order');
            $table->bigInteger('fg_produced_id')->nullable()->unsigned();
            $table->foreign('fg_produced_id')->references('id')->on('fg_produced');
            $table->enum('type', ['issue_from_store', 'return_to_store','line_reject'])->default('issue_from_store');
            $table->integer('change_in_qty')->nullable();
            $table->integer('new_qty')->nullable();
            $table->string('comment')->nullable();
            $table->timestamps();
        });
    }

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