<?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('weather_sub_districts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('sub_district_id');
            $table->double('allsky_sfc_sw_dwn');
            $table->double('prectotcorr');
            $table->double('rh2m');
            $table->double('t2m');
            $table->double('ws2m');
            $table->string('month');
            $table->string('year');
            $table->timestamps();
        });

        schema::table('weather_sub_districts', function (Blueprint $table) {
            $table->foreign('sub_district_id')->references('id')->on('sub_district');
        });
    }

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