<?php

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

class CreateFormDaily46Table extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('form_daily_4_6', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('id_farm_section'); // Foreign key to the farm section
            $table->unsignedBigInteger('created_by'); // Foreign key to the user who created the entry
            $table->text('jenis_tanaman'); 
            $table->string('Blok_Lokasi'); 
            $table->string('jumlah_hasil_tuai'); 
            $table->string('jumlah_hasil_jual');
            $table->string('harga_jualan');
            $table->string('jumlah_harga');
            $table->integer('no_invois');
            $table->string('nama_operator'); // Nama operator
            $table->timestamps();

            // Foreign key constraints can be added as necessary
            $table->foreign('id_farm_section')->references('id')->on('farm_section')->onDelete('cascade');
            $table->foreign('created_by')->references('id')->on('login')->onDelete('cascade');
        });
    }

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