<?php

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

class CreateQuotChallanDetailsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('quot_challan_details', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('quot_challan_id')->nullable()->unsigned();
            $table->foreign('quot_challan_id')->references('id')->on('quot_challan');
            $table->bigInteger('product_id')->nullable()->unsigned();
            $table->foreign('product_id')->references('id')->on('products');
            $table->double('qty')->nullable();
            $table->bigInteger('product_uom_id')->nullable()->unsigned();
            $table->foreign('product_uom_id')->references('id')->on('product_uom');
            $table->double('price')->nullable();
            $table->double('discount')->nullable();
            $table->bigInteger('indirect_tax_id')->nullable()->unsigned();
            $table->foreign('indirect_tax_id')->references('id')->on('indirect_tax');
            $table->date('delivery_date')->nullable();
            $table->string('comment')->nullable();
            $table->double('total_before_tax')->nullable();
            $table->timestamps();
        });
    }

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