iotsaas/backend/sql/V21__fix_member_phone_unique.sql
2995840376 0ce191c448 chore: 初始化 iotsaas 版本库基线
纳入范围:
- backend/  Spring Boot 多模块后端(iot-common/device/rule/data/alarm/auth)
- frontend/admin/  Vue3 + Element Plus 管理后台
- Android/   涂鸦原生 APP (com.xhai.iot)
- backend/sql/  Flyway 风格迁移脚本(V2~V21)
- docs/       对接文档与设计文档

排除范围:
- 构建产物: node_modules/ target/ build/ dist/ .gradle/
- 签名密钥: *.jks *.keystore (严禁入库)
- 本机配置: Android/local.properties
- 运行日志: logs/ *.log
- AI 协作本地数据 .codebuddy/ 与第三方 demo tuya-demo/

.gitattributes 统一以 LF 存储, Windows 批处理保留 CRLF
2026-10-27 12:00:41 +08:00

10 lines
704 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- V21: 修复会员手机号唯一索引对空串冲突(不填手机号的会员注册必失败)
-- 根因:member.phone 为 NOT NULL DEFAULT '' 且 UNIQUE KEY uk_member_phone(phone),
-- 多个 '' 互相撞键(MySQL 唯一索引把 '' 视为普通值,不允许重复)。
-- 修复:列改为可空、默认 NULL(MySQL 唯一索引允许多个 NULL,真实手机号仍唯一);
-- 并把历史遗留的 '' 清洗为 NULL。
-- 说明:本环境 Flyway 未自动执行,需手工执行本文件(与 V3~V20 一致)。
ALTER TABLE `member` MODIFY COLUMN `phone` VARCHAR(20) NULL DEFAULT NULL COMMENT '手机号';
UPDATE `member` SET `phone` = NULL WHERE `phone` = '';