<?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
    {
        Schema::table('general_settings', function (Blueprint $table) {
            if (!Schema::hasColumn('general_settings', 'cta_heading')) {
                $table->string('cta_heading')->nullable();
            }
            if (!Schema::hasColumn('general_settings', 'cta_btn_text')) {
                $table->string('cta_btn_text')->nullable();
            }
        });
    }

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