<?php

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

return new class extends Migration {
    public function up()
    {
        if (!Schema::hasTable('egame_items') || Schema::hasColumn('egame_items', 'logo_langs')) {
            return;
        }

        Schema::table('egame_items', function (Blueprint $table) {
            $table->json('logo_langs')->nullable()->after('logo')->comment('游戏多语言square图');
        });
    }

    public function down()
    {
        if (!Schema::hasTable('egame_items') || !Schema::hasColumn('egame_items', 'logo_langs')) {
            return;
        }

        Schema::table('egame_items', function (Blueprint $table) {
            $table->dropColumn('logo_langs');
        });
    }
};
