<?php

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

class CreateFormDaily44Table extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('form_daily_4_4', 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('cara_pengawasan'); 
            $table->string('lokasi_blok'); 
            $table->string('nama_perosak'); 
            $table->string('bil_perosak_peratusan_kerosakan');
            $table->string('kaedah_kawalan');
            $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_4');
    }
}