DROP TABLE IF EXISTS `T_ONLINECHAT_MESSAGE`;
CREATE TABLE `T_ONLINECHAT_MESSAGE` (
  `UUID` varchar(32) NOT NULL,
  `PARTY_ID` varchar(32) NOT NULL,
  `SEND_RECEIVE` varchar(32) NOT NULL,
  `CONTENT_TYPE` varchar(32) NOT NULL,
  `CONTENT` longtext,
  `CREATE_TIME` datetime NOT NULL,
  PRIMARY KEY (`UUID`),
  KEY `INDEX_ONLINECHAT_MESSAGE_CREATE_TIME` (`CREATE_TIME`),
  KEY `INDEX_PARTY_ID` (`PARTY_ID`),
  KEY `INDEX_SEND_RECEIVE` (`SEND_RECEIVE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `T_MESSAGE_USER`;
CREATE TABLE `T_MESSAGE_USER` (
  `UUID` varchar(32) NOT NULL,
  `PARTY_ID` varchar(32) NOT NULL,
  `TOTAL_MSG` int(11) NOT NULL DEFAULT '0',
  `USER_UNREADMSG` int(11) NOT NULL,
  `CUSTOMER_UNREADMSG` int(11) DEFAULT '0',
  `UPDATETIME` datetime NOT NULL,
  `DELETE_STATUS` int(11) DEFAULT '0',
  PRIMARY KEY (`UUID`),
  KEY `INDEX_PARTY_ID` (`PARTY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `T_OTC_MESSAGE_USER`;
CREATE TABLE `T_OTC_MESSAGE_USER` (
  `UUID` varchar(32) NOT NULL,
  `PARTY_ID` varchar(32) DEFAULT NULL,
  `TOTAL_MSG` int(11) NOT NULL DEFAULT '0',
  `USER_UNREADMSG` int(11) NOT NULL,
  `CUSTOMER_UNREADMSG` int(11) DEFAULT '0',
  `UPDATETIME` datetime NOT NULL,
  `DELETE_STATUS` int(11) DEFAULT '0',
  `REMARKS` varchar(255) DEFAULT NULL,
  `IP` varchar(255) DEFAULT NULL,
  `ORDER_NO` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`UUID`),
  KEY `INDEX_PARTY_ID` (`PARTY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `T_OTC_ONLINECHAT_MESSAGE`;
CREATE TABLE `T_OTC_ONLINECHAT_MESSAGE` (
  `UUID` varchar(32) NOT NULL,
  `PARTY_ID` varchar(32) DEFAULT NULL,
  `SEND_RECEIVE` varchar(32) NOT NULL,
  `CONTENT_TYPE` varchar(32) NOT NULL,
  `CONTENT` longtext,
  `CREATE_TIME` datetime NOT NULL,
  `USERNAME` varchar(255) DEFAULT NULL,
  `IP` varchar(255) DEFAULT NULL,
  `ORDER_NO` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`UUID`),
  KEY `INDEX_ONLINECHAT_MESSAGE_CREATE_TIME` (`CREATE_TIME`),
  KEY `INDEX_PARTY_ID` (`PARTY_ID`),
  KEY `INDEX_SEND_RECEIVE` (`SEND_RECEIVE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ALTER TABLE `T_ONLINECHAT_MESSAGE`
ADD COLUMN `USERNAME`  varchar(255) ;

ALTER TABLE `T_MESSAGE_USER`
ADD COLUMN `REMARKS`  varchar(255) ;


ALTER TABLE `T_MESSAGE_USER`
ADD COLUMN `TARGET_USERNAME`  varchar(64) NULL AFTER `IP`;