<?php

use App\Enums\BioUrlFormat;
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('bio_pages', function (Blueprint $table) {
            $table->string('url_format_override', 32)->nullable()->after('slug');
            $table->boolean('needs_migration')->default(false)->after('is_published');
            $table->timestamp('migration_required_at')->nullable()->after('needs_migration');
        });

        Schema::table('workspaces', function (Blueprint $table) {
            $table->string('bio_url_format', 32)->nullable()->after('subdomain_provisioned_at');
        });
    }

    public function down(): void
    {
        Schema::table('workspaces', fn (Blueprint $t) => $t->dropColumn('bio_url_format'));
        Schema::table('bio_pages', fn (Blueprint $t) => $t->dropColumn(['url_format_override', 'needs_migration', 'migration_required_at']));
    }
};
