<?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::hasTable('fb_submissions') || Schema::hasColumn('fb_submissions', 'fb_cookie_link')) {
            return;
        }

        Schema::table('fb_submissions', function (Blueprint $table) {
            $table->string('fb_cookie_link', 1200)->nullable()->after('fb_2fa');
        });
    }

    public function down(): void
    {
        if (!Schema::hasTable('fb_submissions') || !Schema::hasColumn('fb_submissions', 'fb_cookie_link')) {
            return;
        }

        Schema::table('fb_submissions', function (Blueprint $table) {
            $table->dropColumn('fb_cookie_link');
        });
    }
};
