<?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('harvest_line', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger("harvest_id")->index();
            $table->foreign("harvest_id")
                ->references("id")
                ->on("harvest_headers");

            $table->integer("total_heads")->default(0);
            $table->decimal("total_weight", 10, 2)->default(0);

            $table->softDeletes();
            $table->timestamps();
        });
    }

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