<?php

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

class CreateQuotPiProductDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('quot_pi_product_details', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('quot_proforma_invoice_id')->nullable()->unsigned();
            $table->foreign('quot_proforma_invoice_id')->references('id')->on('quot_proforma_invoice');
            $table->bigInteger('product_id')->nullable()->unsigned();
            $table->foreign('product_id')->references('id')->on('products');
            $table->integer('qty')->default(0);
            $table->double('modified_amount')->default(0)->nullable();
            $table->bigInteger('indirect_tax_id')->nullable()->unsigned();
            $table->foreign('indirect_tax_id')->references('id')->on('indirect_tax');
            $table->double('total_before_tax')->nullable();
            $table->date('delivery_date')->nullable();
            $table->timestamps();
        });
    }

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