<?php

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

class CreatePoExtraChargesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('po_extra_charges', function (Blueprint $table) {
            $table->id();
            $table->string('description')->nullable();
            $table->double('total_amount')->nullable();
            $table->bigInteger('indirect_tax_id')->nullable()->unsigned();
            $table->foreign('indirect_tax_id')->references('id')->on('indirect_tax');
            $table->bigInteger('purchase_order_id')->nullable()->unsigned();
            $table->foreign('purchase_order_id')->references('id')->on('purchase_order');
            $table->double('total_tax')->nullable();
            $table->timestamps();
        });
    }

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