SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

--
-- Table structure for table `u_sub_user`
--
-- DROP TABLE IF EXISTS `u_sub_user`; 
CREATE TABLE IF NOT EXISTS `u_sub_user` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `imsi` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'SIM卡/USIM卡ID',
  `msisdn` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '用户电话号码',
  `ne_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'UDM网元标识',
  `am_dat` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData',
  `ambr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData SubUeAMBRTemp',
  `nssai` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData SubSNSSAITemp',
  `rat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData RAT 0x00:VIRTUAL 0x01:WLAN 0x02:EUTRA 0x03:NR',
  `arfb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData AreaForbidden',
  `sar` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData serviceAreaRestrictTemp',
  `cn_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData CNType 0x00:EPC和5GC 0x01:5GC 0x02:EPC 0x03:EPC+5GC',
  `rfsp_index` varchar(50) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData RfspIndex',
  `reg_timer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData RegTimer',
  `ue_usage_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData UEUsageType',
  `active_time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData ActiveTime',
  `mico` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData MICO',
  `odb_ps` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData ODB_PS 0-all,1-hplmn,2-vplmn',
  `group_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'AmData GroupId',
  `eps_dat` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat',
  `eps_flag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat epsFlag',
  `eps_odb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat epsOdb',
  `hplmn_odb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat hplmnOdb',
  `ard` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat Ard',
  `epstpl` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat Epstpl',
  `context_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat ContextId',
  `apn_mum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat apnNum',
  `apn_context` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat apnContext',
  `static_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'EpsDat staticIp 指给4G UE分配的静态IP，没有可不带此字段名',
  `sm_data` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'smData',
  `smf_sel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'smfSel',
  `cag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT 'CAG',
  `tenant_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'multi-tenancy refer to sys_tenant.tenant_id',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `imsi_ne` (`imsi`,`ne_id`) USING BTREE COMMENT 'imsi_ne唯一索引'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='UDM签约用户';

-- Dump completed on 2024-10-12 15:26:59

ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `am_dat` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData' AFTER `ne_id`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `cn_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData CNType 0x00:EPC和5GC 0x01:5GC 0x02:EPC 0x03:EPC+5GC' AFTER `sar`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `rfsp_index` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData RfspIndex' AFTER `cn_type`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `reg_timer` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData RegTimer' AFTER `rfsp_index`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `ue_usage_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData UEUsageType' AFTER `reg_timer`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `active_time` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData ActiveTime' AFTER `ue_usage_type`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `mico` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData MICO' AFTER `active_time`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `odb_ps` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData ODB_PS 0-all,1-hplmn,2-vplmn' AFTER `mico`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `group_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData GroupId' AFTER `odb_ps`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `apn_mum` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat apnNum' AFTER `context_id`;
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `cag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'CAG' AFTER `smf_sel`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `ambr` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData SubUeAMBRTemp' AFTER `am_dat`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `nssai` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData SubSNSSAITemp' AFTER `ambr`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `rat` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData RAT 0x00:VIRTUAL 0x01:WLAN 0x02:EUTRA 0x03:NR' AFTER `nssai`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `arfb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData AreaForbidden' AFTER `rat`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `sar` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'AmData serviceAreaRestrictTemp' AFTER `arfb`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `eps_dat` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat' AFTER `group_id`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `eps_flag` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat epsFlag' AFTER `eps_dat`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `eps_odb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat epsOdb' AFTER `eps_flag`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `hplmn_odb` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat hplmnOdb' AFTER `eps_odb`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `ard` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat Ard' AFTER `hplmn_odb`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `epstpl` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat Epstpl' AFTER `ard`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `context_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat ContextId' AFTER `epstpl`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `apn_context` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat apnContext' AFTER `apn_mum`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `static_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'EpsDat staticIp 指给4G UE分配的静态IP，没有可不带此字段名' AFTER `apn_context`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `sm_data` varchar(1500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'smData' AFTER `static_ip`;
ALTER TABLE `u_sub_user` MODIFY COLUMN IF EXISTS `smf_sel` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT 'smfSel' AFTER `sm_data`;
ALTER TABLE `u_sub_user` DROP COLUMN IF EXISTS `cn`;

-- multi-tenancy
ALTER TABLE `u_sub_user` ADD COLUMN IF NOT EXISTS `tenant_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'multi-tenancy refer to sys_tenant.tenant_id' AFTER `cag`;
