数据库脚本 #5

Open
opened 2023-12-26 17:18:03 +08:00 by 李寻欢 · 0 comments
Owner
/*
 Navicat Premium Data Transfer

 Source Server         : 10.0.0.31-3307-wechat
 Source Server Type    : MySQL
 Source Server Version : 80028 (8.0.28)
 Source Host           : 10.0.0.31:3307
 Source Schema         : wechat

 Target Server Type    : MySQL
 Target Server Version : 80028 (8.0.28)
 File Encoding         : 65001

 Date: 18/06/2024 17:18:12
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_ai_assistant
-- ----------------------------
DROP TABLE IF EXISTS `t_ai_assistant`;
CREATE TABLE `t_ai_assistant`  (
  `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'名称\'',
  `personality` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'人设\'',
  `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'使用的模型\'',
  `enable` tinyint(1) NOT NULL DEFAULT 1 COMMENT '\'是否启用\'',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_friend
-- ----------------------------
DROP TABLE IF EXISTS `t_friend`;
CREATE TABLE `t_friend`  (
  `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id',
  `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称',
  `pinyin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '简拼',
  `pinyin_all` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '全拼',
  `custom_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号',
  `is_ok` tinyint(1) NULL DEFAULT 1 COMMENT '是否在通讯录',
  `enable_ai` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用AI',
  `ai_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'AI模型',
  `prompt` varchar(999) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '提示词',
  `enable_chat_rank` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用水群排行榜',
  `enable_summary` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用聊天记录总结',
  `enable_welcome` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用迎新',
  `enable_command` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用指令',
  `enable_news` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用早报',
  `clear_member` int NULL DEFAULT 0 COMMENT '清理多少天未活跃的成员,0表示不清理',
  `last_active` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后活跃时间',
  PRIMARY KEY (`wxid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_group_user
-- ----------------------------
DROP TABLE IF EXISTS `t_group_user`;
CREATE TABLE `t_group_user`  (
  `group_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信群Id',
  `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信id',
  `account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号',
  `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称',
  `head_image` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像',
  `is_member` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否群成员0否1是',
  `join_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '加入时间',
  `last_active` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后活跃时间',
  `leave_time` datetime NULL DEFAULT NULL COMMENT '退群时间',
  `skip_chat_rank` tinyint(1) NULL DEFAULT 0 COMMENT '是否跳过水群排行榜',
  `is_admin` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否管理员',
  PRIMARY KEY (`group_id`, `wxid`) USING BTREE,
  INDEX `idx_one`(`group_id` ASC, `wxid` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_message
-- ----------------------------
DROP TABLE IF EXISTS `t_message`;
CREATE TABLE `t_message`  (
  `msg_id` bigint NOT NULL COMMENT '消息Id',
  `create_time` bigint NOT NULL COMMENT '创建时间',
  `create_at` datetime NULL DEFAULT NULL,
  `from_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送人或群id',
  `group_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '群成员id',
  `type` int NOT NULL COMMENT '消息类型',
  `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容',
  `to_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '接收者',
  `display_full_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '显示的完整内容',
  `raw` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '原始通知字符串',
  PRIMARY KEY (`msg_id`) USING BTREE,
  INDEX `idx_msg_from_user`(`from_user` ASC) USING BTREE,
  INDEX `idx_msg_group_user`(`group_user` ASC) USING BTREE,
  INDEX `idx_msg_type`(`type` ASC) USING BTREE,
  INDEX `idx_created_at`(`create_at` DESC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_plugin_data
-- ----------------------------
DROP TABLE IF EXISTS `t_plugin_data`;
CREATE TABLE `t_plugin_data`  (
  `user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id',
  `plugin_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '插件代码',
  `data` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '插件数据',
  PRIMARY KEY (`user_id`, `plugin_code`) USING BTREE,
  UNIQUE INDEX `idx_pd_onlyone`(`user_id` ASC, `plugin_code` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for t_robot
-- ----------------------------
DROP TABLE IF EXISTS `t_robot`;
CREATE TABLE `t_robot`  (
  `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器人Id',
  `created_at` datetime(3) NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
  `updated_at` datetime(3) NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
  `deleted_at` bigint NULL DEFAULT 0 COMMENT '删除时间戳',
  `is_del` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
  `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id',
  `account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号',
  `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称',
  `avatar` varchar(999) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像',
  `mobile` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号',
  `current_data_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '当前数据目录,登录的账号目录',
  `data_save_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信保存目录',
  `db_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数据库的SQLCipher的加密key,可以使用该key配合decrypt.py解密数据库',
  `hook_api` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '机器人hook接口地址',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `deleted`(`deleted_at` ASC, `is_del` ASC, `wxid` ASC) USING BTREE COMMENT '删除索引',
  INDEX `idx_wxid`(`wxid` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;

```sql /* Navicat Premium Data Transfer Source Server : 10.0.0.31-3307-wechat Source Server Type : MySQL Source Server Version : 80028 (8.0.28) Source Host : 10.0.0.31:3307 Source Schema : wechat Target Server Type : MySQL Target Server Version : 80028 (8.0.28) File Encoding : 65001 Date: 18/06/2024 17:18:12 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for t_ai_assistant -- ---------------------------- DROP TABLE IF EXISTS `t_ai_assistant`; CREATE TABLE `t_ai_assistant` ( `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'名称\'', `personality` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'人设\'', `model` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '\'使用的模型\'', `enable` tinyint(1) NOT NULL DEFAULT 1 COMMENT '\'是否启用\'', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for t_friend -- ---------------------------- DROP TABLE IF EXISTS `t_friend`; CREATE TABLE `t_friend` ( `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id', `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称', `pinyin` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '简拼', `pinyin_all` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '全拼', `custom_account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号', `is_ok` tinyint(1) NULL DEFAULT 1 COMMENT '是否在通讯录', `enable_ai` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用AI', `ai_model` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'AI模型', `prompt` varchar(999) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '提示词', `enable_chat_rank` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用水群排行榜', `enable_summary` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用聊天记录总结', `enable_welcome` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用迎新', `enable_command` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用指令', `enable_news` tinyint(1) NULL DEFAULT 0 COMMENT '是否启用早报', `clear_member` int NULL DEFAULT 0 COMMENT '清理多少天未活跃的成员,0表示不清理', `last_active` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后活跃时间', PRIMARY KEY (`wxid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for t_group_user -- ---------------------------- DROP TABLE IF EXISTS `t_group_user`; CREATE TABLE `t_group_user` ( `group_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信群Id', `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信id', `account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号', `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称', `head_image` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像', `is_member` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否群成员0否1是', `join_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '加入时间', `last_active` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最后活跃时间', `leave_time` datetime NULL DEFAULT NULL COMMENT '退群时间', `skip_chat_rank` tinyint(1) NULL DEFAULT 0 COMMENT '是否跳过水群排行榜', `is_admin` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否管理员', PRIMARY KEY (`group_id`, `wxid`) USING BTREE, INDEX `idx_one`(`group_id` ASC, `wxid` ASC) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for t_message -- ---------------------------- DROP TABLE IF EXISTS `t_message`; CREATE TABLE `t_message` ( `msg_id` bigint NOT NULL COMMENT '消息Id', `create_time` bigint NOT NULL COMMENT '创建时间', `create_at` datetime NULL DEFAULT NULL, `from_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '发送人或群id', `group_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '群成员id', `type` int NOT NULL COMMENT '消息类型', `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '内容', `to_user` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '接收者', `display_full_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '显示的完整内容', `raw` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '原始通知字符串', PRIMARY KEY (`msg_id`) USING BTREE, INDEX `idx_msg_from_user`(`from_user` ASC) USING BTREE, INDEX `idx_msg_group_user`(`group_user` ASC) USING BTREE, INDEX `idx_msg_type`(`type` ASC) USING BTREE, INDEX `idx_created_at`(`create_at` DESC) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for t_plugin_data -- ---------------------------- DROP TABLE IF EXISTS `t_plugin_data`; CREATE TABLE `t_plugin_data` ( `user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id', `plugin_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '插件代码', `data` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '插件数据', PRIMARY KEY (`user_id`, `plugin_code`) USING BTREE, UNIQUE INDEX `idx_pd_onlyone`(`user_id` ASC, `plugin_code` ASC) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for t_robot -- ---------------------------- DROP TABLE IF EXISTS `t_robot`; CREATE TABLE `t_robot` ( `id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '机器人Id', `created_at` datetime(3) NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', `updated_at` datetime(3) NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间', `deleted_at` bigint NULL DEFAULT 0 COMMENT '删除时间戳', `is_del` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除', `wxid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '微信Id', `account` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信号', `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '昵称', `avatar` varchar(999) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像', `mobile` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '手机号', `current_data_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '当前数据目录,登录的账号目录', `data_save_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '微信保存目录', `db_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '数据库的SQLCipher的加密key,可以使用该key配合decrypt.py解密数据库', `hook_api` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '机器人hook接口地址', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `deleted`(`deleted_at` ASC, `is_del` ASC, `wxid` ASC) USING BTREE COMMENT '删除索引', INDEX `idx_wxid`(`wxid` ASC) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1; ```
李寻欢 pinned this 2023-12-26 17:18:15 +08:00
李寻欢 locked as Resolved and limited conversation to collaborators 2023-12-26 17:19:04 +08:00
李寻欢 added the
question
label 2024-01-16 09:57:15 +08:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lxh/go-wxhelper#5
No description provided.