<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     * Fix addon_type column to support unsigned values (65535 = -1 in signed short)
     * MySQL 8 strict mode rejects out-of-range values
     */
    public function up()
    {
        // Change addon_type from SMALLINT to INT to handle both positive and negative values
        DB::connection('player')->statement('ALTER TABLE item_proto MODIFY COLUMN addon_type INT DEFAULT 0');
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        DB::connection('player')->statement('ALTER TABLE item_proto MODIFY COLUMN addon_type SMALLINT DEFAULT 0');
    }
};
