im-platform.sql 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 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. `tmp_id` varchar(32) comment '临时id,由前端生成',
  33. `send_id` bigint not null comment '发送用户id',
  34. `recv_id` bigint not null comment '接收用户id',
  35. `content` text comment '发送内容',
  36. `type` tinyint not null comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示',
  37. `status` tinyint not null comment '状态 0:未读 1:已读 2:撤回 3:已读',
  38. `send_time` datetime default current_timestamp comment '发送时间',
  39. key `idx_send_id` (`send_id`),
  40. key `idx_recv_id` (`recv_id`)
  41. ) engine = innodb charset = utf8mb4 comment '私聊消息';
  42. create table `im_group` (
  43. `id` bigint not null auto_increment primary key comment 'id',
  44. `name` varchar(255) not null comment '群名字',
  45. `owner_id` bigint not null comment '群主id',
  46. `head_image` varchar(255) default '' comment '群头像',
  47. `head_image_thumb` varchar(255) default '' comment '群头像缩略图',
  48. `notice` varchar(1024) default '' comment '群公告',
  49. `is_banned` tinyint(1) default 0 comment '是否被封禁 0:否 1:是',
  50. `reason` varchar(255) default '' comment '被封禁原因',
  51. `dissolve` tinyint(1) default 0 comment '是否已解散',
  52. `created_time` datetime default current_timestamp comment '创建时间'
  53. ) engine = innodb charset = utf8mb4 comment '群';
  54. create table `im_group_member` (
  55. `id` bigint not null auto_increment primary key comment 'id',
  56. `group_id` bigint not null comment '群id',
  57. `user_id` bigint not null comment '用户id',
  58. `user_nick_name` varchar(255) default '' comment '用户昵称',
  59. `remark_nick_name` varchar(255) default '' comment '显示昵称备注',
  60. `head_image` varchar(255) default '' comment '用户头像',
  61. `remark_group_name` varchar(255) default '' comment '显示群名备注',
  62. `is_dnd` tinyint(1) comment '免打扰标识(do not disturb) 0:关闭 1:开启',
  63. `quit` tinyint(1) default 0 comment '是否已退出',
  64. `quit_time` datetime default null comment '退出时间',
  65. `created_time` datetime default current_timestamp comment '创建时间',
  66. key `idx_group_id` (`group_id`),
  67. key `idx_user_id` (`user_id`)
  68. ) engine = innodb charset = utf8mb4 comment '群成员';
  69. create table `im_group_message` (
  70. `id` bigint not null auto_increment primary key comment 'id',
  71. `tmp_id` varchar(32) comment '临时id,由前端生成',
  72. `group_id` bigint not null comment '群id',
  73. `send_id` bigint not null comment '发送用户id',
  74. `send_nick_name` varchar(255) default '' comment '发送用户昵称',
  75. `recv_ids` varchar(1024) default '' comment '接收用户id,逗号分隔,为空表示发给所有成员',
  76. `content` text comment '发送内容',
  77. `at_user_ids` varchar(1024) comment '被@的用户id列表,逗号分隔',
  78. `receipt` tinyint(1) default 0 comment '是否回执消息',
  79. `receipt_ok` tinyint(1) default 0 comment '回执消息是否完成',
  80. `type` tinyint not null comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示',
  81. `status` tinyint default 0 comment '状态 0:未发出 2:撤回 ',
  82. `send_time` datetime default current_timestamp comment '发送时间',
  83. key `idx_group_id` (group_id)
  84. ) engine = innodb charset = utf8mb4 comment '群消息';
  85. create table `im_sensitive_word` (
  86. `id` bigint not null auto_increment primary key comment 'id',
  87. `content` varchar(64) not null comment '敏感词内容',
  88. `enabled` tinyint(1) default 0 comment '是否启用 0:未启用 1:启用',
  89. `creator` bigint default null comment '创建者',
  90. `create_time` datetime default current_timestamp comment '创建时间'
  91. ) engine = innodb charset = utf8mb4 comment '敏感词';
  92. create table `im_file_info` (
  93. `id` bigint not null auto_increment primary key comment 'id',
  94. `file_name` varchar(255) not null comment '文件名',
  95. `file_path` varchar(255) not null comment '文件地址',
  96. `file_size` integer not null comment '文件大小',
  97. `file_type` tinyint not null comment '0:普通文件 1:图片 2:视频',
  98. `compressed_path` varchar(255) default null comment '压缩文件路径',
  99. `cover_path` varchar(255) default null comment '封面文件路径,仅视频文件有效',
  100. `upload_time` datetime default current_timestamp comment '上传时间',
  101. `is_permanent` tinyint(1) default 0 comment '是否永久文件',
  102. `md5` varchar(64) not null comment '文件md5',
  103. key `idx_md5` (md5)
  104. ) engine = innodb charset = utf8mb4 comment '文件';