<?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('document_settings', function (Blueprint $table): void {
            if (! Schema::hasColumn('document_settings', 'custom_defaults')) {
                $table->json('custom_defaults')->nullable();
            }
        });
    }

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