<?php

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

class CreateFgProducedRoutingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fg_produced_routing', 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->string('comment')->nullable();
            $table->boolean('is_done')->nullable();
            $table->bigInteger('routing_id')->nullable()->unsigned();
            $table->foreign('routing_id')->references('id')->on('bom_routing');
            $table->timestamps();
        });
    }

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