<?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('dataset_table26', function (Blueprint $table) {
            $table->id('DatasetTable26Id');
            $table->integer('dataset_id');
            $table->string('lokasi_pemantauan')->nullable(); // Lokasi Pemantauan
            $table->string('latitude')->nullable();  // Latitude (7 digit desimal cukup presisi)
            $table->string('longitude')->nullable(); // Longitude
            $table->timestamp('waktu_pemantauan')->nullable(); // Waktu Pemantauan
            $table->string('ph')->nullable();    // pH biasanya 0-14 (cukup 5,2)
            $table->string('dhl')->nullable();  // DHL (konduktivitas)
            $table->string('so4')->nullable();  // SO4
            $table->string('no3')->nullable();  // NO3
            $table->string('cr')->nullable();   // Cr
            $table->string('nh4')->nullable();  // NH4
            $table->string('na')->nullable();   // Na
            $table->string('ca2')->nullable();  // Ca2+
            $table->string('mg2')->nullable();  // Mg2+

            $table->integer('created_by');
            $table->timestampsTz();
            $table->softdeletesTz();

            $table->foreign('dataset_id')->references('DatasetId')->on('dataset')->cascadeOnDelete();
        });
    }

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