-- M001/M003 数据库字符排序规则加固：统一把现有字符串列改为大小写敏感。
-- 背景：外部系统 opaque id 可能只差大小写，例如 Outlook external_message_id 中的 X/x。
-- MySQL 默认 *_ci collation 会把这类值当成相同字符串，导致幂等查询和唯一键误判。
-- 说明：以下 MySQL 版本注释在 MySQL 8.0+ 会执行；H2 MySQL Mode 会把它们当注释跳过，避免本地 H2 测试库不支持 utf8mb4_bin 语法。

-- SourceMessage：来源消息、正文、媒体、原文审计和重复投递诊断。
/*!80000 ALTER TABLE platform_source_message_inbox DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_inbox CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_inbox
    MODIFY COLUMN external_message_id VARCHAR(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT '外部邮件系统中的单封邮件唯一 ID，对应 AgentBus source.external_message_id；解析失败时允许为空以保留失败记录' */;
/*!80000 ALTER TABLE platform_source_message_payload DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_payload CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_body DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_body CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_media DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_media CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_original_access_audit DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_original_access_audit CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_payload_duplicate DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_source_message_payload_duplicate CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;

-- SuperAgent / Reservation：AI 入站、订单、任务、任务卡、审计和 OPERA 模拟。
/*!80000 ALTER TABLE integration_superagent_task_result_nonce DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE integration_superagent_task_result_nonce CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_ai_batch DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_ai_batch CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_ai_transition DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_ai_transition CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_order DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_order CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_task DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_task CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_task_card DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_task_card CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_audit_log DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_audit_log CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_opera_operation DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_opera_operation CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_opera_operation_attempt DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE workflow_reservation_opera_operation_attempt CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;

-- Debug EML：调试上传链路中的外部 ID、OSS URL、SuperAgent 运行标识和状态。
/*!80000 ALTER TABLE platform_debug_eml_superagent_run DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_debug_eml_superagent_run CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;

-- Identity / Access / Hotel / Menu：用户、角色、权限、酒店和菜单基础表。
/*!80000 ALTER TABLE platform_user DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_session DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_session CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_role DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_role CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_permission DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_permission CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_role DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_role CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_role_permission DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_role_permission CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_hotel DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_hotel CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_hotel DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_user_hotel CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_menu DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
/*!80000 ALTER TABLE platform_menu CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_bin */;
