<?php

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

class CreatePoDocApproveProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('po_doc_approve_products', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('po_doc_approve_id')->nullable()->unsigned();
            $table->foreign('po_doc_approve_id')->references('id')->on('po_doc_approve');
            $table->bigInteger('product_id')->nullable()->unsigned();
            $table->foreign('product_id')->references('id')->on('products');
            $table->bigInteger('purchase_ledgers_id')->nullable()->unsigned();
            $table->foreign('purchase_ledgers_id')->references('id')->on('purchase_ledgers');
            $table->timestamps();
        });
    }

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