<?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('investment_settings', function (Blueprint $table) {
            if (! Schema::hasColumn('investment_settings', 'payment_method')) {
                $table->string('payment_method')->default('TRC20')->after('monthly_return');
            }

            if (! Schema::hasColumn('investment_settings', 'payment_address')) {
                $table->string('payment_address')->default('TUjJn5yk7XvkESScqMqPvThPvvzJASK1BYN')->after('payment_method');
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('investment_settings', function (Blueprint $table) {
            if (Schema::hasColumn('investment_settings', 'payment_address')) {
                $table->dropColumn('payment_address');
            }

            if (Schema::hasColumn('investment_settings', 'payment_method')) {
                $table->dropColumn('payment_method');
            }
        });
    }
};
