<?php

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

return new class extends Migration {
    public function up(): void
    {
        DB::statement("
            ALTER TABLE product_config_options
            MODIFY type ENUM('number','select','checkboxgroup','checkbox','text','ip_address')
            NOT NULL DEFAULT 'select'
        ");
    }

    public function down(): void
    {
        DB::table('product_config_options')->where('type', 'ip_address')->update(['type' => 'checkbox']);
        DB::statement("
            ALTER TABLE product_config_options
            MODIFY type ENUM('number','select','checkboxgroup','checkbox','text')
            NOT NULL DEFAULT 'select'
        ");
    }
};
