<?php

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

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('sales_details', function (Blueprint $table) {

            $table->id();
            $table->unsignedBigInteger('sales_masters_id');
            $table->string('product_id');
            $table->string('attribute_id');
            $table->string('qty');
            $table->string('fqty')->nullable();
            $table->string('category_id')->nullable();
            $table->string('unit_id')->nullable();
            $table->string('order_details_id')->nullable();
            $table->string('buy_price')->nullable();
            $table->string('price');
            $table->string('discount')->nullable();
            $table->string('after_discount')->nullable();
            $table->string('total')->nullable();
            $table->string('discount_type')->nullable();
            $table->string('warranty_time')->nullable();
            $table->string('warranty_code')->nullable();
            $table->string('warranty_type')->nullable();
            $table->string('batch_no')->nullable();
            $table->timestamps();
            $table->foreign('sales_masters_id')->references('id')->on('sales_masters')->onDelete('cascade');
        });
    }

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