-- Deploy gaia:user_callback_list_peotect_phone to mysql

BEGIN;

-- XXX Add DDLs here.
-- 华为云电话绑定关系表
CREATE TABLE `hera_protect_phone_huaweiyun_binding_relationship` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `subscription_id` varchar(256) NOT NULL DEFAULT '',
  `operator_id` varchar(64) DEFAULT NULL,
  `user_id` varchar(64) DEFAULT NULL,
  `relationNum` varchar(64) DEFAULT NULL,
  `bind_time` datetime(6) DEFAULT NULL,
  `unbind_time` datetime(6) DEFAULT NULL,
  `is_bind` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- 华为云通话记录表
CREATE TABLE `hera_protect_phone_huaweiyun_call_records` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `session_id` varchar(256) NOT NULL DEFAULT '',
  `subscription_id` varchar(256) DEFAULT NULL,
  `user_id` varchar(64) DEFAULT NULL,
  `operator_id` varchar(64) DEFAULT NULL,
  `call_status` int(11) DEFAULT NULL,
  `active_status` int(11) DEFAULT NULL,
  `active_status_time` datetime(6) DEFAULT NULL,
  `call_in_time` datetime(6) DEFAULT NULL,
  `call_end_time` datetime(6) DEFAULT NULL,
  `duration` int(11) DEFAULT NULL,
  `remark` varchar(1024) DEFAULT NULL,
  `audio_url` varchar(256) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- 转诊用户回拨列表
CREATE TABLE `hera_protect_phone_user_callback_list` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` varchar(64) NOT NULL DEFAULT '',
  `favor` varchar(128) DEFAULT '',
  `city_id` varchar(64) DEFAULT NULL,
  `is_get_wechat` tinyint(1) NOT NULL,
  `wechat` varchar(64) DEFAULT NULL,
  `operator_id` varchar(64) DEFAULT NULL,
  `bind_time` datetime(6) DEFAULT NULL,
  `unbind_time` datetime(6) DEFAULT NULL,
  `call_status` int(11) DEFAULT NULL,
  `session_id` varchar(255) DEFAULT NULL,
  `subscription_id` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

COMMIT;
