<?php

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

return new class extends Migration
{
    public function up(): void
    {
        DB::table('websites_extras')
            ->whereNull('is_enabled')
            ->update(['is_enabled' => true]);

        Schema::table('websites_extras', function (Blueprint $table): void {
            $table->boolean('is_enabled')->default(true)->nullable(false)->change();
        });
    }

    public function down(): void
    {
        Schema::table('websites_extras', function (Blueprint $table): void {
            $table->boolean('is_enabled')->nullable()->default(null)->change();
        });
    }
};
