消息表中添加contenttype

This commit is contained in:
heavyrain.lee
2019-06-12 22:36:08 +08:00
parent dde9da7006
commit c857d1abb7
3 changed files with 42 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
alter table `t_messages` add column `_content_type` int(11) NOT NULL DEFAULT '0';
+36
View File
@@ -0,0 +1,36 @@
alter table `t_messages_0` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_1` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_2` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_3` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_4` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_5` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_6` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_7` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_8` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_9` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_10` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_11` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_12` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_13` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_14` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_15` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_16` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_17` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_18` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_19` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_20` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_21` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_22` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_23` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_24` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_25` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_26` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_27` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_28` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_29` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_30` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_31` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_32` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_33` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_34` add column `_content_type` int(11) NOT NULL DEFAULT '0';
alter table `t_messages_35` add column `_content_type` int(11) NOT NULL DEFAULT '0';
@@ -384,11 +384,12 @@ public class DatabaseStore {
try {
connection = DBUtil.getConnection();
String sql = "insert into " + MessageShardingUtil.getMessageTable(message.getMessageId()) +
" (`_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_searchable_key`, `_dt`) values(?, ?, ?, ?, ?, ?, ?, ?)" +
" (`_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_searchable_key`, `_dt`, `_content_type`) values(?, ?, ?, ?, ?, ?, ?, ?, ?)" +
" ON DUPLICATE KEY UPDATE " +
"`_data` = ?," +
"`_searchable_key` = ?," +
"`_dt` = ?";
"`_dt` = ?," +
"`_content_type` = ?";
String searchableContent = message.getContent().getSearchableContent() == null ? "" : message.getContent().getSearchableContent();
@@ -404,10 +405,12 @@ public class DatabaseStore {
statement.setBlob(index++, blob);
statement.setString(index++, searchableContent);
statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp()));
statement.setInt(index++, message.getContent().getType());
statement.setBlob(index++, blob);
statement.setString(index++, searchableContent);
statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp()));
statement.setInt(index++, message.getContent().getType());
int count = statement.executeUpdate();
LOG.info("Update rows {}", count);