<?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::table('district_settings', function (Blueprint $table) {
            // Adds the column right after the primary 'id' column. 
            // Nullable ensures it won't break if you already have existing rows.
            $table->unsignedBigInteger('district_id')->nullable()->after('id');
            
            // PRO-TIP: If you actually have a 'districts' table and want a strict foreign key relationship, 
            // comment out the line above and use this line instead:
            // $table->foreignId('district_id')->nullable()->after('id')->constrained('districts')->cascadeOnDelete();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('district_settings', function (Blueprint $table) {
            // Safely removes the column if you ever roll back this migration
            $table->dropColumn('district_id');
        });
    }
};