<?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_table48a', function (Blueprint $table) {
            $table->id('DatasetTable48AId');
            $table->integer('dataset_id');
            $table->string('lokasi')->nullable();
            $table->string('tahun')->nullable();
            $table->string('nama_bank_sampah')->nullable();
            $table->string('sk')->nullable(); // Nomor SK
            $table->float('jumlah_sampah')->default(0); // Kg per bulan, pakai decimal
            $table->string('status')->nullable();
            $table->string('kelurahan')->nullable();
            $table->string('rw')->nullable(); // RW biasanya 2–3 digit
            $table->integer('jumlah_penabung')->nullable();
            $table->integer('jumlah_karyawan')->nullable();
            $table->float('omset')->default(0); // Rupiah, bisa sangat besar
            $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_table48_a_s');
    }
};
