<?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('users', function (Blueprint $table) {
            $table->json('chat_preferences')->nullable()->after('custom_leave_effect')->comment('聊天室屏蔽与禁音偏好配置');
        });
    }

    /**
     * 回滚用户表中的聊天室偏好配置字段。
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('chat_preferences');
        });
    }
};
