<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        if (!Schema::hasColumn('aduan_tps', 'alamat_pelapor')) {
            Schema::table('aduan_tps', function (Blueprint $table) {
                $table->string('alamat_pelapor')->after('nama_pelapor');
            });
        }
    }

    public function down(): void
    {
        if (Schema::hasColumn('aduan_tps', 'alamat_pelapor')) {
            Schema::table('aduan_tps', function (Blueprint $table) {
                $table->dropColumn('alamat_pelapor');
            });
        }
    }
};
