<?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_table32', function (Blueprint $table) {
            $table->id('DatasetTable32Id');
            $table->integer('dataset_id');
            $table->string('lokasi')->nullable(); // Kabupaten/Kota/Kec.
            // Jumlah penduduk per kategori pendidikan (L = Laki-laki, P = Perempuan)
            $table->float('tidak_sekolah_l')->default(0);
            $table->float('tidak_sekolah_p')->default(0);
            $table->float('sd_l')->default(0);
            $table->float('sd_p')->default(0);
            $table->float('sltp_l')->default(0);
            $table->float('sltp_p')->default(0);
            $table->float('slta_smk_l')->default(0);
            $table->float('slta_smk_p')->default(0);
            $table->float('pt_l')->nullable();  // defaultT0inggi
            $table->float('pt_p')->default(0);
            $table->float('s1_l')->default(0);
            $table->float('s1_p')->default(0);
            $table->float('s2_l')->default(0);
            $table->float('s2_p')->default(0);
            $table->float('s3_l')->default(0);
            $table->float('s3_p')->default(0);
            $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_table32s');
    }
};
