diff --git a/broker/migrate/h2/V1__baseline.sql b/broker/migrate/h2/V1__baseline.sql new file mode 100755 index 00000000..e69de29b diff --git a/broker/h2/create_table.sql b/broker/migrate/h2/V2__create_table.sql similarity index 79% rename from broker/h2/create_table.sql rename to broker/migrate/h2/V2__create_table.sql index 30ae0df9..706bc5f8 100755 --- a/broker/h2/create_table.sql +++ b/broker/migrate/h2/V2__create_table.sql @@ -1,26 +1,4 @@ -DROP TABLE IF EXISTS `t_messages`; -CREATE TABLE `t_messages` ( - `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `_mid` bigint(20) NOT NULL, - `_from` varchar(64) NOT NULL, - `_type` tinyint NOT NULL DEFAULT 0, - `_target` varchar(64) NOT NULL, - `_line` int(11) NOT NULL DEFAULT 0, - `_data` BLOB NOT NULL, - `_searchable_key` TEXT DEFAULT NULL, - `_dt` DATETIME NOT NULL DEFAULT NOW(), - UNIQUE INDEX `message_uid_index` (`_mid` ASC) -); -DROP TABLE IF EXISTS `t_user_messages`; -CREATE TABLE `t_user_messages` ( - `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `_mid` bigint(20) NOT NULL, - `_uid` varchar(64) NOT NULL, - `_seq` bigint(20) NOT NULL, - `_dt` DATETIME NOT NULL DEFAULT NOW(), - UNIQUE INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) -); DROP TABLE IF EXISTS `t_group`; CREATE TABLE `t_group` ( @@ -220,17 +198,3 @@ CREATE TABLE `t_sensitiveword` ( `_word` TEXT DEFAULT NULL ); - - -insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom1','火信聊天室1','火信测试聊天室1,用来演示聊天室功能', 1); - -insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom2','火信聊天室2','火信测试聊天室2,用来演示聊天室功能', 1); - -insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom3','火信聊天室3','火信测试聊天室3,用来演示聊天室功能', 1); - -insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('FireRobot','FireRobot','小火','http://cdn2.wildfirechat.cn/robot.png',1,1); - -insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('FireRobot', 'FireRobot', '123456', 'http://127.0.0.1:8883/robot/recvmsg', 0, 1); - - -alter table t_friend add column `_alias` varchar(64) DEFAULT NULL; diff --git a/broker/migrate/h2/V3__create_sharding_table.sql b/broker/migrate/h2/V3__create_sharding_table.sql new file mode 100755 index 00000000..e660f7b5 --- /dev/null +++ b/broker/migrate/h2/V3__create_sharding_table.sql @@ -0,0 +1,24 @@ + +DROP TABLE IF EXISTS `t_messages`; +CREATE TABLE `t_messages` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + UNIQUE INDEX `message_uid_index` (`_mid` ASC) +); + +DROP TABLE IF EXISTS `t_user_messages`; +CREATE TABLE `t_user_messages` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + UNIQUE INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +); diff --git a/broker/migrate/h2/V4__create_default_chatroom.sql b/broker/migrate/h2/V4__create_default_chatroom.sql new file mode 100755 index 00000000..13984ea0 --- /dev/null +++ b/broker/migrate/h2/V4__create_default_chatroom.sql @@ -0,0 +1,6 @@ + +insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom1','火信聊天室1','火信测试聊天室1,用来演示聊天室功能', 1); + +insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom2','火信聊天室2','火信测试聊天室2,用来演示聊天室功能', 1); + +insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom3','火信聊天室3','火信测试聊天室3,用来演示聊天室功能', 1); diff --git a/broker/migrate/h2/V5__create_default_robot.sql b/broker/migrate/h2/V5__create_default_robot.sql new file mode 100755 index 00000000..60f06353 --- /dev/null +++ b/broker/migrate/h2/V5__create_default_robot.sql @@ -0,0 +1,4 @@ + +insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('FireRobot','FireRobot','小火','http://cdn2.wildfirechat.cn/robot.png',1,1); + +insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('FireRobot', 'FireRobot', '123456', 'http://127.0.0.1:8883/robot/recvmsg', 0, 1); diff --git a/broker/migrate/h2/V6__add_friend_alias.sql b/broker/migrate/h2/V6__add_friend_alias.sql new file mode 100755 index 00000000..74f1ece9 --- /dev/null +++ b/broker/migrate/h2/V6__add_friend_alias.sql @@ -0,0 +1,2 @@ + +alter table t_friend add column `_alias` varchar(64) DEFAULT NULL; diff --git a/broker/migrate/mysql/V1__baseline.sql b/broker/migrate/mysql/V1__baseline.sql new file mode 100755 index 00000000..e69de29b diff --git a/broker/sql/2_create_table.sql b/broker/migrate/mysql/V2__create_table.sql similarity index 99% rename from broker/sql/2_create_table.sql rename to broker/migrate/mysql/V2__create_table.sql index 860958e6..50e1ebaf 100755 --- a/broker/sql/2_create_table.sql +++ b/broker/migrate/mysql/V2__create_table.sql @@ -1,3 +1,4 @@ + DROP TABLE IF EXISTS `t_messages`; CREATE TABLE `t_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, diff --git a/broker/migrate/mysql/V3__create_sharding_table.sql b/broker/migrate/mysql/V3__create_sharding_table.sql new file mode 100755 index 00000000..426dc025 --- /dev/null +++ b/broker/migrate/mysql/V3__create_sharding_table.sql @@ -0,0 +1,2353 @@ + +DROP TABLE IF EXISTS `t_messages_0`; +CREATE TABLE `t_messages_0` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_1`; +CREATE TABLE `t_messages_1` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_2`; +CREATE TABLE `t_messages_2` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_3`; +CREATE TABLE `t_messages_3` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_4`; +CREATE TABLE `t_messages_4` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_5`; +CREATE TABLE `t_messages_5` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_6`; +CREATE TABLE `t_messages_6` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_7`; +CREATE TABLE `t_messages_7` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_8`; +CREATE TABLE `t_messages_8` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_9`; +CREATE TABLE `t_messages_9` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_10`; +CREATE TABLE `t_messages_10` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_11`; +CREATE TABLE `t_messages_11` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_12`; +CREATE TABLE `t_messages_12` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_13`; +CREATE TABLE `t_messages_13` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_14`; +CREATE TABLE `t_messages_14` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_15`; +CREATE TABLE `t_messages_15` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_16`; +CREATE TABLE `t_messages_16` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_17`; +CREATE TABLE `t_messages_17` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_18`; +CREATE TABLE `t_messages_18` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_19`; +CREATE TABLE `t_messages_19` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_20`; +CREATE TABLE `t_messages_20` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_21`; +CREATE TABLE `t_messages_21` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_22`; +CREATE TABLE `t_messages_22` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_23`; +CREATE TABLE `t_messages_23` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_24`; +CREATE TABLE `t_messages_24` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_25`; +CREATE TABLE `t_messages_25` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_26`; +CREATE TABLE `t_messages_26` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_27`; +CREATE TABLE `t_messages_27` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_28`; +CREATE TABLE `t_messages_28` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_29`; +CREATE TABLE `t_messages_29` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_30`; +CREATE TABLE `t_messages_30` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_31`; +CREATE TABLE `t_messages_31` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_32`; +CREATE TABLE `t_messages_32` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_messages_33`; +CREATE TABLE `t_messages_33` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_34`; +CREATE TABLE `t_messages_34` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_messages_35`; +CREATE TABLE `t_messages_35` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_from` varchar(64) NOT NULL, + `_type` tinyint NOT NULL DEFAULT 0, + `_target` varchar(64) NOT NULL, + `_line` int(11) NOT NULL DEFAULT 0, + `_data` BLOB NOT NULL, + `_searchable_key` TEXT DEFAULT NULL, + `_dt` DATETIME NOT NULL, + INDEX `message_uid_index` (`_mid` DESC) + ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_0`; +CREATE TABLE `t_user_messages_0` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_1`; +CREATE TABLE `t_user_messages_1` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_2`; +CREATE TABLE `t_user_messages_2` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_3`; +CREATE TABLE `t_user_messages_3` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_4`; +CREATE TABLE `t_user_messages_4` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_5`; +CREATE TABLE `t_user_messages_5` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_6`; +CREATE TABLE `t_user_messages_6` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_7`; +CREATE TABLE `t_user_messages_7` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_8`; +CREATE TABLE `t_user_messages_8` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_9`; +CREATE TABLE `t_user_messages_9` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_10`; +CREATE TABLE `t_user_messages_10` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_11`; +CREATE TABLE `t_user_messages_11` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_12`; +CREATE TABLE `t_user_messages_12` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_13`; +CREATE TABLE `t_user_messages_13` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_14`; +CREATE TABLE `t_user_messages_14` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_15`; +CREATE TABLE `t_user_messages_15` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_16`; +CREATE TABLE `t_user_messages_16` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_17`; +CREATE TABLE `t_user_messages_17` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_18`; +CREATE TABLE `t_user_messages_18` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_19`; +CREATE TABLE `t_user_messages_19` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_20`; +CREATE TABLE `t_user_messages_20` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_21`; +CREATE TABLE `t_user_messages_21` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_22`; +CREATE TABLE `t_user_messages_22` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_23`; +CREATE TABLE `t_user_messages_23` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_24`; +CREATE TABLE `t_user_messages_24` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_25`; +CREATE TABLE `t_user_messages_25` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_26`; +CREATE TABLE `t_user_messages_26` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_27`; +CREATE TABLE `t_user_messages_27` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_28`; +CREATE TABLE `t_user_messages_28` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_29`; +CREATE TABLE `t_user_messages_29` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_30`; +CREATE TABLE `t_user_messages_30` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_31`; +CREATE TABLE `t_user_messages_31` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_32`; +CREATE TABLE `t_user_messages_32` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_33`; +CREATE TABLE `t_user_messages_33` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_34`; +CREATE TABLE `t_user_messages_34` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_35`; +CREATE TABLE `t_user_messages_35` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_36`; +CREATE TABLE `t_user_messages_36` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_37`; +CREATE TABLE `t_user_messages_37` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_38`; +CREATE TABLE `t_user_messages_38` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_39`; +CREATE TABLE `t_user_messages_39` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_40`; +CREATE TABLE `t_user_messages_40` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_41`; +CREATE TABLE `t_user_messages_41` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_42`; +CREATE TABLE `t_user_messages_42` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_43`; +CREATE TABLE `t_user_messages_43` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_44`; +CREATE TABLE `t_user_messages_44` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_45`; +CREATE TABLE `t_user_messages_45` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_46`; +CREATE TABLE `t_user_messages_46` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_47`; +CREATE TABLE `t_user_messages_47` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_48`; +CREATE TABLE `t_user_messages_48` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_49`; +CREATE TABLE `t_user_messages_49` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_50`; +CREATE TABLE `t_user_messages_50` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_51`; +CREATE TABLE `t_user_messages_51` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_52`; +CREATE TABLE `t_user_messages_52` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_53`; +CREATE TABLE `t_user_messages_53` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_54`; +CREATE TABLE `t_user_messages_54` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_55`; +CREATE TABLE `t_user_messages_55` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_56`; +CREATE TABLE `t_user_messages_56` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_57`; +CREATE TABLE `t_user_messages_57` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_58`; +CREATE TABLE `t_user_messages_58` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_59`; +CREATE TABLE `t_user_messages_59` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_60`; +CREATE TABLE `t_user_messages_60` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_61`; +CREATE TABLE `t_user_messages_61` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_62`; +CREATE TABLE `t_user_messages_62` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_63`; +CREATE TABLE `t_user_messages_63` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_64`; +CREATE TABLE `t_user_messages_64` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_65`; +CREATE TABLE `t_user_messages_65` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_66`; +CREATE TABLE `t_user_messages_66` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_67`; +CREATE TABLE `t_user_messages_67` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_68`; +CREATE TABLE `t_user_messages_68` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_69`; +CREATE TABLE `t_user_messages_69` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_70`; +CREATE TABLE `t_user_messages_70` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_71`; +CREATE TABLE `t_user_messages_71` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_72`; +CREATE TABLE `t_user_messages_72` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_73`; +CREATE TABLE `t_user_messages_73` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_74`; +CREATE TABLE `t_user_messages_74` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_75`; +CREATE TABLE `t_user_messages_75` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_76`; +CREATE TABLE `t_user_messages_76` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_77`; +CREATE TABLE `t_user_messages_77` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_78`; +CREATE TABLE `t_user_messages_78` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_79`; +CREATE TABLE `t_user_messages_79` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_80`; +CREATE TABLE `t_user_messages_80` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_81`; +CREATE TABLE `t_user_messages_81` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_82`; +CREATE TABLE `t_user_messages_82` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_83`; +CREATE TABLE `t_user_messages_83` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_84`; +CREATE TABLE `t_user_messages_84` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_85`; +CREATE TABLE `t_user_messages_85` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_86`; +CREATE TABLE `t_user_messages_86` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_87`; +CREATE TABLE `t_user_messages_87` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_88`; +CREATE TABLE `t_user_messages_88` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_89`; +CREATE TABLE `t_user_messages_89` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_90`; +CREATE TABLE `t_user_messages_90` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_91`; +CREATE TABLE `t_user_messages_91` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_92`; +CREATE TABLE `t_user_messages_92` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_93`; +CREATE TABLE `t_user_messages_93` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_94`; +CREATE TABLE `t_user_messages_94` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_95`; +CREATE TABLE `t_user_messages_95` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_96`; +CREATE TABLE `t_user_messages_96` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_97`; +CREATE TABLE `t_user_messages_97` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_98`; +CREATE TABLE `t_user_messages_98` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_99`; +CREATE TABLE `t_user_messages_99` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_100`; +CREATE TABLE `t_user_messages_100` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_101`; +CREATE TABLE `t_user_messages_101` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_102`; +CREATE TABLE `t_user_messages_102` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_103`; +CREATE TABLE `t_user_messages_103` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_104`; +CREATE TABLE `t_user_messages_104` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_105`; +CREATE TABLE `t_user_messages_105` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_106`; +CREATE TABLE `t_user_messages_106` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_107`; +CREATE TABLE `t_user_messages_107` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_108`; +CREATE TABLE `t_user_messages_108` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_109`; +CREATE TABLE `t_user_messages_109` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_110`; +CREATE TABLE `t_user_messages_110` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_111`; +CREATE TABLE `t_user_messages_111` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_112`; +CREATE TABLE `t_user_messages_112` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_113`; +CREATE TABLE `t_user_messages_113` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_114`; +CREATE TABLE `t_user_messages_114` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_115`; +CREATE TABLE `t_user_messages_115` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_116`; +CREATE TABLE `t_user_messages_116` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_117`; +CREATE TABLE `t_user_messages_117` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_118`; +CREATE TABLE `t_user_messages_118` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_119`; +CREATE TABLE `t_user_messages_119` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_120`; +CREATE TABLE `t_user_messages_120` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_121`; +CREATE TABLE `t_user_messages_121` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_122`; +CREATE TABLE `t_user_messages_122` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_123`; +CREATE TABLE `t_user_messages_123` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_124`; +CREATE TABLE `t_user_messages_124` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_125`; +CREATE TABLE `t_user_messages_125` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + + +DROP TABLE IF EXISTS `t_user_messages_126`; +CREATE TABLE `t_user_messages_126` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + +DROP TABLE IF EXISTS `t_user_messages_127`; +CREATE TABLE `t_user_messages_127` ( + `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, + `_mid` bigint(20) NOT NULL, + `_uid` varchar(64) NOT NULL, + `_seq` bigint(20) NOT NULL, + `_dt` DATETIME NOT NULL DEFAULT NOW(), + INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) +) +ENGINE = InnoDB +DEFAULT CHARACTER SET = utf8mb4 +COLLATE = utf8mb4_unicode_ci; + diff --git a/broker/sql/3_create_default_chatroom.sql b/broker/migrate/mysql/V4__create_default_chatroom.sql similarity index 100% rename from broker/sql/3_create_default_chatroom.sql rename to broker/migrate/mysql/V4__create_default_chatroom.sql diff --git a/broker/sql/4_create_default_robot.sql b/broker/migrate/mysql/V5__create_default_robot.sql similarity index 100% rename from broker/sql/4_create_default_robot.sql rename to broker/migrate/mysql/V5__create_default_robot.sql diff --git a/broker/sql/5_add_friend_alias.sql b/broker/migrate/mysql/V6__add_friend_alias.sql similarity index 100% rename from broker/sql/5_add_friend_alias.sql rename to broker/migrate/mysql/V6__add_friend_alias.sql diff --git a/broker/pom.xml b/broker/pom.xml index 11b4f854..4c869b86 100755 --- a/broker/pom.xml +++ b/broker/pom.xml @@ -257,6 +257,13 @@ 3.13.1 + + + org.flywaydb + flyway-core + 5.2.4 + + diff --git a/broker/sql/1_create_database.sql b/broker/sql/1_create_database.sql deleted file mode 100755 index b42eec36..00000000 --- a/broker/sql/1_create_database.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE DATABASE IF NOT EXISTS wfchat CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; diff --git a/broker/sql/initialize_db.sh b/broker/sql/initialize_db.sh deleted file mode 100755 index 72e17b44..00000000 --- a/broker/sql/initialize_db.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -show_help_info(){ - echo "### Usage: ./initial_db.sh -u{user} -p{password}" - echo "### 初始化数据库。" - echo "###" - -} - -for i in "$@" -do - PFLAG=`echo $i|cut -b1-2` - PPARAM=`echo $i|cut -b3-` - if [ $PFLAG = "-u" ]; then - USER=${PPARAM} - elif [ $PFLAG = "-p" ]; then - PASSWORD=${PPARAM} - elif [ $PFLAG = "-h" ]; then - show_help_info - exit 1 - fi -done - -echo - -if [ "${USER}" = "" ]; then - show_help_info - exit 1 -elif [ "${PASSWORD}" = "" ]; then - show_help_info - exit 1 -fi - - -mysql -u${USER} -p${PASSWORD} -e"source 1_create_database.sql;" -mysql -u${USER} -p${PASSWORD} -e"use wfchat; source 2_create_table.sql; source 3_create_default_chatroom.sql; source 4_create_default_robot.sql; source 5_add_friend_alias.sql;" - -for((i=0;i<36;i++)); -do - create_message_tbl_sql="USE wfchat; - DROP TABLE IF EXISTS \`t_messages_${i}\`; - CREATE TABLE \`t_messages_${i}\` ( - \`id\` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - \`_mid\` bigint(20) NOT NULL, - \`_from\` varchar(64) NOT NULL, - \`_type\` tinyint NOT NULL DEFAULT 0, - \`_target\` varchar(64) NOT NULL, - \`_line\` int(11) NOT NULL DEFAULT 0, - \`_data\` BLOB NOT NULL, - \`_searchable_key\` TEXT DEFAULT NULL, - \`_dt\` DATETIME NOT NULL, - INDEX \`message_uid_index\` (\`_mid\` DESC) - ) - ENGINE = InnoDB - DEFAULT CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; - " - - echo "create table t_messages_$i" - mysql -u${USER} -p${PASSWORD} -e"${create_message_tbl_sql}" -done - - -for((i=0;i<128;i++)); -do - create_user_message_tbl_sql="USE wfchat; - DROP TABLE IF EXISTS \`t_user_messages_${i}\`; - CREATE TABLE \`t_user_messages_${i}\` ( - \`id\` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, - \`_mid\` bigint(20) NOT NULL, - \`_uid\` varchar(64) NOT NULL, - \`_seq\` bigint(20) NOT NULL, - \`_dt\` DATETIME NOT NULL DEFAULT NOW(), - INDEX \`message_seq_uid_index\` (\`_uid\` DESC, \`_seq\` DESC) - ) - ENGINE = InnoDB - DEFAULT CHARACTER SET = utf8mb4 - COLLATE = utf8mb4_unicode_ci; - " - - echo "create table t_user_messages_$i" - mysql -u${USER} -p${PASSWORD} -e"${create_user_message_tbl_sql}" -done diff --git a/broker/src/main/java/io/moquette/server/Server.java b/broker/src/main/java/io/moquette/server/Server.java index bb06e870..e5666d85 100755 --- a/broker/src/main/java/io/moquette/server/Server.java +++ b/broker/src/main/java/io/moquette/server/Server.java @@ -370,7 +370,8 @@ public class Server { throw new IllegalArgumentException("nodeId error: " + nodeIdStr); } if (nodeIdSet != null && nodeIdSet.contains(nodeId)){ - throw new IllegalArgumentException("nodeId conflict " + nodeId + ", 请修改wildfirechat.conf文件,是各个节点的nodeId不冲突"); + LOG.error("只允许一个实例运行,多个实例会引起冲突,进程终止"); + System.exit(-1); } MessageShardingUtil.setNodeId(nodeId); diff --git a/broker/src/main/java/win/liyufan/im/DBUtil.java b/broker/src/main/java/win/liyufan/im/DBUtil.java index 8e87a164..0a07b4d7 100755 --- a/broker/src/main/java/win/liyufan/im/DBUtil.java +++ b/broker/src/main/java/win/liyufan/im/DBUtil.java @@ -12,9 +12,7 @@ package win.liyufan.im; import java.beans.PropertyVetoException; import java.io.BufferedReader; import java.io.FileReader; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; import java.util.ArrayList; import java.util.List; @@ -22,11 +20,11 @@ import com.hazelcast.util.StringUtil; import com.mchange.v2.c3p0.ComboPooledDataSource; import io.moquette.BrokerConstants; import io.moquette.server.config.IConfig; +import org.flywaydb.core.Flyway; +import org.flywaydb.core.api.configuration.FlywayConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.sql.PreparedStatement; -import java.sql.Connection; import java.util.concurrent.ConcurrentHashMap; public class DBUtil { @@ -53,9 +51,10 @@ public class DBUtil { LOG.info("Use mysql database"); } - if (comboPooledDataSource == null) { + String migrateLocation; if (IsEmbedDB) { + migrateLocation = "filesystem:./migrate/h2"; comboPooledDataSource = new ComboPooledDataSource(); comboPooledDataSource.setJdbcUrl( "jdbc:h2:./h2db/wfchat;AUTO_SERVER=TRUE;MODE=MySQL" ); @@ -74,48 +73,34 @@ public class DBUtil { } catch (PropertyVetoException e) { e.printStackTrace(); Utility.printExecption(LOG, e); - } - - ResultSet rs = null; - Connection connection = null; - try { - connection = comboPooledDataSource.getConnection(); - } catch (SQLException e) { - e.printStackTrace(); - Utility.printExecption(LOG, e); - } - Statement stmt = null; - try { - connection = DBUtil.getConnection(); - rs = connection.getMetaData().getTables(null, null, "t_user_setting", null ); - if (!rs.next()) { - List creatsqls = getCreateSql(); - for (String createsql : creatsqls) { - if (StringUtil.isNullOrEmpty(createsql)) { - break; - } - stmt = connection.createStatement(); - if (0 != stmt.executeLargeUpdate(createsql)) { - LOG.error("创建表失败! {}", createsql); -// System.exit(-1); - } - try { - stmt.close(); - } catch (SQLException e) { - e.printStackTrace(); - Utility.printExecption(LOG, e); - } - } - } - } catch (SQLException e) { - e.printStackTrace(); - Utility.printExecption(LOG, e); - } finally { - DBUtil.closeDB(connection, null, rs); + System.exit(-1); } } else { + migrateLocation = "filesystem:./migrate/mysql"; comboPooledDataSource = new ComboPooledDataSource("mysql"); + try { + String url01 = comboPooledDataSource.getJdbcUrl().substring(0,comboPooledDataSource.getJdbcUrl().indexOf("?")); + + String url02 = url01.substring(0,url01.lastIndexOf("/")); + + String datasourceName = url01.substring(url01.lastIndexOf("/")+1); + // 连接已经存在的数据库,如:mysql + Connection connection = DriverManager.getConnection(url02, comboPooledDataSource.getUser(), comboPooledDataSource.getPassword()); + Statement statement = connection.createStatement(); + + // 创建数据库 + statement.executeUpdate("CREATE DATABASE IF NOT EXISTS `" + datasourceName + "` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"); + + statement.close(); + connection.close(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(-1); + } + } + Flyway flyway = Flyway.configure().dataSource(comboPooledDataSource).locations(migrateLocation).baselineOnMigrate(true).load(); + flyway.migrate(); } } diff --git a/distribution/src/main/assembly/assembly.xml b/distribution/src/main/assembly/assembly.xml index d2565765..2ff5c962 100755 --- a/distribution/src/main/assembly/assembly.xml +++ b/distribution/src/main/assembly/assembly.xml @@ -9,6 +9,18 @@ false + + + ../broker/migrate/mysql/ + /migrate/mysql + + + + ../broker/migrate/h2/ + /migrate/h2 + + + @@ -46,47 +58,11 @@ src/main/resources/README.txt - - ../broker/sql/1_create_database.sql - sql/ - - - - ../broker/sql/2_create_table.sql - sql/ - - - - ../broker/sql/3_create_default_chatroom.sql - sql/ - - - - ../broker/sql/4_create_default_robot.sql - sql/ - - - - ../broker/sql/5_add_friend_alias.sql - sql/ - - - - ../broker/sql/initialize_db.sh - sql/ - - src/main/resources/git.properties config/ - - - ../broker/h2/create_table.sql - h2/ - - ../broker/target/moquette-broker-${project.version}.jar lib/