21 lines
1.2 KiB
SQL
21 lines
1.2 KiB
SQL
-- 航空账号增加品牌渠道(channel):CZ 南航 / MU 东航 / HU 海航
|
|
-- 目的:三个 App 使用同一手机号分别登录,互不干扰。
|
|
-- 唯一键调整:
|
|
-- uk_mobile (mobile, deleted, tenant_id) -> 废弃
|
|
-- uk_device_id (device_id, deleted, tenant_id) -> 废弃
|
|
-- uk_mobile_channel (mobile, channel, deleted, tenant_id) -> 同一手机号每渠道一个账号
|
|
-- uk_channel_device (channel, device_id, deleted, tenant_id) -> 同一设备每渠道绑定一个账号
|
|
|
|
ALTER TABLE `member_airline_account`
|
|
ADD COLUMN `channel` varchar(8) NOT NULL DEFAULT 'CZ' COMMENT '品牌渠道(CZ南航/MU东航/HU海航)' AFTER `mobile`;
|
|
|
|
-- 存量数据归属渠道默认回填为 CZ(南航),如实际属于东航/海航请手工执行:
|
|
-- UPDATE `member_airline_account` SET `channel` = 'MU' WHERE ...;
|
|
-- UPDATE `member_airline_account` SET `channel` = 'HU' WHERE ...;
|
|
|
|
ALTER TABLE `member_airline_account`
|
|
DROP INDEX `uk_mobile`,
|
|
DROP INDEX `uk_device_id`,
|
|
ADD UNIQUE KEY `uk_mobile_channel` (`mobile`, `channel`, `deleted`, `tenant_id`),
|
|
ADD UNIQUE KEY `uk_channel_device` (`channel`, `device_id`, `deleted`, `tenant_id`);
|