im-platform.sql 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
  25. key `idx_user_id` (`user_id`),
  26. key `idx_friend_id` (`friend_id`)
  27. ) ENGINE=InnoDB CHARSET=utf8mb4 comment '好友';
  28. create table `im_private_message`(
  29. `id` bigint not null auto_increment primary key comment 'id',
  30. `send_id` bigint not null comment '发送用户id',
  31. `recv_id` bigint not null comment '接收用户id',
  32. `content` text comment '发送内容',
  33. `type` tinyint(1) NOT NULL comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示',
  34. `status` tinyint(1) NOT NULL comment '状态 0:未读 1:已读 2:撤回 3:已读',
  35. `send_time` datetime DEFAULT CURRENT_TIMESTAMP comment '发送时间',
  36. key `idx_send_id` (`send_id`),
  37. key `idx_recv_id` (`recv_id`)
  38. )ENGINE=InnoDB CHARSET=utf8mb4 comment '私聊消息';
  39. create table `im_group`(
  40. `id` bigint not null auto_increment primary key comment 'id',
  41. `name` varchar(255) not null comment '群名字',
  42. `owner_id` bigint not null comment '群主id',
  43. `head_image` varchar(255) default '' comment '群头像',
  44. `head_image_thumb` varchar(255) default '' comment '群头像缩略图',
  45. `notice` varchar(1024) default '' comment '群公告',
  46. `is_banned` tinyint(1) default 0 comment '是否被封禁 0:否 1:是',
  47. `reason` varchar(255) default '' comment '被封禁原因',
  48. `dissolve` tinyint(1) default 0 comment '是否已解散',
  49. `created_time` datetime default CURRENT_TIMESTAMP comment '创建时间'
  50. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群';
  51. create table `im_group_member`(
  52. `id` bigint not null auto_increment primary key comment 'id',
  53. `group_id` bigint not null comment '群id',
  54. `user_id` bigint not null comment '用户id',
  55. `user_nick_name` varchar(255) DEFAULT '' comment '用户昵称',
  56. `remark_nick_name` varchar(255) DEFAULT '' comment '显示昵称备注',
  57. `head_image` varchar(255) DEFAULT '' comment '用户头像',
  58. `remark_group_name` varchar(255) DEFAULT '' comment '显示群名备注',
  59. `quit` tinyint(1) DEFAULT 0 comment '是否已退出',
  60. `quit_time` datetime DEFAULT NULL comment '退出时间',
  61. `created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
  62. key `idx_group_id`(`group_id`),
  63. key `idx_user_id`(`user_id`)
  64. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群成员';
  65. create table `im_group_message`(
  66. `id` bigint not null auto_increment primary key comment 'id',
  67. `group_id` bigint not null comment '群id',
  68. `send_id` bigint not null comment '发送用户id',
  69. `send_nick_name` varchar(255) DEFAULT '' comment '发送用户昵称',
  70. `recv_ids` varchar(1024) DEFAULT '' comment '接收用户id,逗号分隔,为空表示发给所有成员',
  71. `content` text comment '发送内容',
  72. `at_user_ids` varchar(1024) comment '被@的用户id列表,逗号分隔',
  73. `receipt` tinyint DEFAULT 0 comment '是否回执消息',
  74. `receipt_ok` tinyint DEFAULT 0 comment '回执消息是否完成',
  75. `type` tinyint(1) NOT NULL comment '消息类型 0:文字 1:图片 2:文件 3:语音 4:视频 21:提示' ,
  76. `status` tinyint(1) DEFAULT 0 comment '状态 0:未发出 2:撤回 ',
  77. `send_time` datetime DEFAULT CURRENT_TIMESTAMP comment '发送时间',
  78. key `idx_group_id` (group_id)
  79. )ENGINE=InnoDB CHARSET=utf8mb4 comment '群消息';
  80. create table `im_sensitive_word`(
  81. `id` bigint not null auto_increment primary key comment 'id',
  82. `content` varchar(64) not null comment '敏感词内容',
  83. `enabled` tinyint DEFAULT 0 COMMENT '是否启用 0:未启用 1:启用',
  84. `creator` bigint DEFAULT NULL COMMENT '创建者',
  85. `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'
  86. )ENGINE=InnoDB CHARSET=utf8mb4 comment '敏感词';