im-platform.sql 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. create table `im_user`(
  2. `id` bigint not null auto_increment primary key comment 'id',
  3. `user_name` varchar(255) not null comment '用户名',
  4. `nick_name` varchar(255) not null comment '用户昵称',
  5. `head_image` varchar(255) default '' comment '用户头像',
  6. `head_image_thumb` varchar(255) default '' comment '用户头像缩略图',
  7. `password` varchar(255) not null comment '密码',
  8. `sex` tinyint(1) default 0 comment '性别 0:男 1:女',
  9. `is_banned` tinyint(1) default 0 comment '是否被封禁 0:否 1:是',
  10. `reason` varchar(255) default '' comment '被封禁原因',
  11. `type` smallint default 1 comment '用户类型 1:普通用户 2:审核账户',
  12. `signature` varchar(1024) default '' comment '个性签名',
  13. `last_login_time` datetime DEFAULT null comment '最后登录时间',
  14. `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
  15. unique key `idx_user_name`(user_name),
  16. key `idx_nick_name`(nick_name)
  17. ) ENGINE=InnoDB CHARSET=utf8mb4 comment '用户';
  18. create table `im_friend`(
  19. `id` bigint not null auto_increment primary key comment 'id',
  20. `user_id` bigint not null comment '用户id',
  21. `friend_id` bigint not null comment '好友id',
  22. `friend_nick_name` varchar(255) not null comment '好友昵称',
  23. `friend_head_image` varchar(255) default '' comment '好友头像',
  24. `is_dnd` tinyint comment '免打扰标识(Do Not Disturb) 0:关闭 1:开启',
  25. `deleted` tinyint comment '删除标识 0:正常 1:已删除',
  26. `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
  27. key `idx_user_id` (`user_id`),
  28. key `idx_friend_id` (`friend_id`)
  29. ) ENGINE=InnoDB CHARSET=utf8mb4 comment '好友';
  30. create table `im_private_message`(
  31. `id` bigint not null auto_increment primary key comment 'id',
  32. `send_id` bigint not null comment '发送用户id',
  33. `recv_id` bigint not null comment '接收用户id',
  34. `content` text comment '发送内容',
  35. `type` tinyint(1) NOT NULL comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示',
  36. `status` tinyint(1) NOT NULL comment '状态 0:未读 1:已读 2:撤回 3:已读',
  37. `send_time` datetime DEFAULT CURRENT_TIMESTAMP comment '发送时间',
  38. key `idx_send_id` (`send_id`),
  39. key `idx_recv_id` (`recv_id`)
  40. )ENGINE=InnoDB CHARSET=utf8mb4 comment '私聊消息';
  41. create table `im_group`(
  42. `id` bigint not null auto_increment primary key comment 'id',
  43. `name` varchar(255) not null comment '群名字',
  44. `owner_id` bigint not null comment '群主id',
  45. `head_image` varchar(255) default '' comment '群头像',
  46. `head_image_thumb` varchar(255) default '' comment '群头像缩略图',
  47. `notice` varchar(1024) default '' comment '群公告',
  48. `is_banned` tinyint(1) default 0 comment '是否被封禁 0:否 1:是',
  49. `reason` varchar(255) default '' comment '被封禁原因',
  50. `dissolve` tinyint(1) default 0 comment '是否已解散',
  51. `created_time` datetime default CURRENT_TIMESTAMP comment '创建时间'
  52. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群';
  53. create table `im_group_member`(
  54. `id` bigint not null auto_increment primary key comment 'id',
  55. `group_id` bigint not null comment '群id',
  56. `user_id` bigint not null comment '用户id',
  57. `user_nick_name` varchar(255) DEFAULT '' comment '用户昵称',
  58. `remark_nick_name` varchar(255) DEFAULT '' comment '显示昵称备注',
  59. `head_image` varchar(255) DEFAULT '' comment '用户头像',
  60. `remark_group_name` varchar(255) DEFAULT '' comment '显示群名备注',
  61. `is_dnd` tinyint comment '免打扰标识(Do Not Disturb) 0:关闭 1:开启',
  62. `quit` tinyint(1) DEFAULT 0 comment '是否已退出',
  63. `quit_time` datetime DEFAULT NULL comment '退出时间',
  64. `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
  65. key `idx_group_id`(`group_id`),
  66. key `idx_user_id`(`user_id`)
  67. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群成员';
  68. create table `im_group_message`(
  69. `id` bigint not null auto_increment primary key comment 'id',
  70. `group_id` bigint not null comment '群id',
  71. `send_id` bigint not null comment '发送用户id',
  72. `send_nick_name` varchar(255) DEFAULT '' comment '发送用户昵称',
  73. `recv_ids` varchar(1024) DEFAULT '' comment '接收用户id,逗号分隔,为空表示发给所有成员',
  74. `content` text comment '发送内容',
  75. `at_user_ids` varchar(1024) comment '被@的用户id列表,逗号分隔',
  76. `receipt` tinyint DEFAULT 0 comment '是否回执消息',
  77. `receipt_ok` tinyint DEFAULT 0 comment '回执消息是否完成',
  78. `type` tinyint(1) NOT NULL comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示' ,
  79. `status` tinyint(1) DEFAULT 0 comment '状态 0:未发出 2:撤回 ',
  80. `send_time` datetime DEFAULT CURRENT_TIMESTAMP comment '发送时间',
  81. key `idx_group_id` (group_id)
  82. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群消息';
  83. create table `im_sensitive_word`(
  84. `id` bigint not null auto_increment primary key comment 'id',
  85. `content` varchar(64) not null comment '敏感词内容',
  86. `enabled` tinyint DEFAULT 0 COMMENT '是否启用 0:未启用 1:启用',
  87. `creator` bigint DEFAULT NULL COMMENT '创建者',
  88. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'
  89. )ENGINE=InnoDB CHARSET=utf8mb4 comment '敏感词';
  90. CREATE TABLE `im_file_info` (
  91. `id` BIGINT NOT NULL auto_increment PRIMARY key comment 'id',
  92. `file_name` VARCHAR(255) NOT NULL comment '文件名',
  93. `file_path` VARCHAR(255) NOT NULL comment '文件地址',
  94. `file_size` INTEGER NOT NULL comment '文件大小',
  95. `file_type` tinyint NOT NULL comment '0:普通文件 1:图片 2:视频',
  96. `compressed_path` VARCHAR(255) DEFAULT NULL comment '压缩文件路径',
  97. `cover_path` VARCHAR(255) DEFAULT NULL comment '封面文件路径,仅视频文件有效',
  98. `upload_time` datetime DEFAULT CURRENT_TIMESTAMP comment '上传时间',
  99. `is_permanent` tinyint DEFAULT 0 comment '是否永久文件',
  100. `md5` VARCHAR(64) NOT NULL comment '文件md5',
  101. UNIQUE KEY `idx_md5` (md5)
  102. ) ENGINE = InnoDB CHARSET = utf8mb4 comment '文件';