Blame view

yudao-module-im/src/test/resources/sql/create_tables.sql 18.2 KB
f495f9c8   YunaiV   ✨ feat(im): 添加私聊私...
1
2
3
4
5
  CREATE TABLE IF NOT EXISTS "im_private_message" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "client_message_id" varchar(64) DEFAULT NULL COMMENT '客户端消息编号',
      "sender_id" bigint NOT NULL COMMENT '发送人编号',
      "receiver_id" bigint NOT NULL COMMENT '接收人编号',
6e823f84   YunaiV   ✨ feat(im): 增加群消息的置顶
6
      "type" smallint NOT NULL COMMENT '消息类型',
012dc011   YunaiV   ✨ feat(im): 初始化群名...
7
      "content" varchar(8192) DEFAULT NULL COMMENT '消息内容',
f495f9c8   YunaiV   ✨ feat(im): 添加私聊私...
8
      "status" tinyint NOT NULL COMMENT '消息状态',
927b64fc   YunaiV   feat(im): 统一消息读位置...
9
      "receipt_status" tinyint NOT NULL DEFAULT 0 COMMENT '回执状态',
f495f9c8   YunaiV   ✨ feat(im): 添加私聊私...
10
11
12
13
14
15
16
      "send_time" timestamp NOT NULL COMMENT '发送时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
513c1301   YunaiV   fix(im):加固群聊与好友部分流程
17
18
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_private_message_sender_client" UNIQUE ("sender_id", "client_message_id", "tenant_id")
f495f9c8   YunaiV   ✨ feat(im): 添加私聊私...
19
  ) COMMENT 'IM 私聊消息表';
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
20
21
22
23
24
25
  
  CREATE TABLE IF NOT EXISTS "im_group_message" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "client_message_id" varchar(64) DEFAULT NULL COMMENT '客户端消息编号',
      "sender_id" bigint NOT NULL COMMENT '发送人编号',
      "group_id" bigint NOT NULL COMMENT '群编号',
6e823f84   YunaiV   ✨ feat(im): 增加群消息的置顶
26
      "type" smallint NOT NULL COMMENT '消息类型',
012dc011   YunaiV   ✨ feat(im): 初始化群名...
27
      "content" varchar(8192) DEFAULT NULL COMMENT '消息内容',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
28
29
      "status" tinyint NOT NULL COMMENT '消息状态',
      "send_time" timestamp NOT NULL COMMENT '发送时间',
120e4415   YunaiV   feat(im):清理多余的 TODO
30
      "receiver_user_ids" text DEFAULT NULL COMMENT '定向接收用户编号列表',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
31
32
33
34
35
36
37
38
      "at_user_ids" varchar(1024) DEFAULT NULL COMMENT '@ 目标用户编号列表',
      "receipt_status" tinyint NOT NULL DEFAULT 0 COMMENT '回执状态',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
513c1301   YunaiV   fix(im):加固群聊与好友部分流程
39
40
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_group_message_sender_client" UNIQUE ("sender_id", "client_message_id", "tenant_id")
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
41
42
43
44
45
46
47
48
49
50
51
52
53
  ) COMMENT 'IM 群聊消息表';
  
  CREATE TABLE IF NOT EXISTS "im_group" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "name" varchar(64) NOT NULL COMMENT '群名称',
      "owner_user_id" bigint NOT NULL COMMENT '群主用户编号',
      "avatar" varchar(512) DEFAULT NULL COMMENT '群头像',
      "notice" varchar(2048) DEFAULT NULL COMMENT '群公告',
      "banned" bit DEFAULT FALSE COMMENT '是否封禁',
      "banned_reason" varchar(512) DEFAULT NULL COMMENT '封禁原因',
      "banned_time" timestamp DEFAULT NULL COMMENT '封禁时间',
      "status" tinyint NOT NULL COMMENT '群状态',
      "dissolved_time" timestamp DEFAULT NULL COMMENT '解散时间',
96ae9bbc   YunaiV   feat(IM):群禁言功能(阶段...
54
      "muted_all" bit DEFAULT FALSE COMMENT '是否全群禁言',
b320e3c1   YunaiV   ✨ feat(im): 初始化群申...
55
      "join_approval" bit NOT NULL DEFAULT FALSE COMMENT '进群是否需群主 / 管理员审批;false 自由进群,true 需审批',
6e823f84   YunaiV   ✨ feat(im): 增加群消息的置顶
56
      "pinned_message_ids" varchar(128) DEFAULT NULL COMMENT '群置顶消息编号列表,逗号分隔',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
57
58
59
60
61
62
63
64
65
66
67
68
69
70
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 群信息表';
  
  CREATE TABLE IF NOT EXISTS "im_group_member" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "group_id" bigint NOT NULL COMMENT '群编号',
      "user_id" bigint NOT NULL COMMENT '用户编号',
      "display_user_name" varchar(64) DEFAULT NULL COMMENT '组内显示名',
1c29398d   YunaiV   ✨ feat(im): 增加群角色...
71
      "group_remark" varchar(64) DEFAULT NULL COMMENT '群备注',
14090be6   YunaiV   feat(im):将"免打扰"字段...
72
      "silent" bit DEFAULT FALSE COMMENT '是否免打扰',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
73
      "status" tinyint NOT NULL COMMENT '成员状态',
1c29398d   YunaiV   ✨ feat(im): 增加群角色...
74
      "role" tinyint NOT NULL DEFAULT 3 COMMENT '成员角色:1=群主 2=管理员 3=普通成员',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
75
      "join_time" timestamp DEFAULT NULL COMMENT '入群时间',
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
76
77
      "add_source" tinyint DEFAULT NULL COMMENT '加入来源',
      "inviter_user_id" bigint DEFAULT NULL COMMENT '邀请人用户编号;用户主动申请进群时为 NULL',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
78
      "quit_time" timestamp DEFAULT NULL COMMENT '退群时间',
96ae9bbc   YunaiV   feat(IM):群禁言功能(阶段...
79
      "mute_end_time" timestamp DEFAULT NULL COMMENT '禁言到期时间',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
80
81
82
83
84
85
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
513c1301   YunaiV   fix(im):加固群聊与好友部分流程
86
87
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_group_member" UNIQUE ("group_id", "user_id", "tenant_id")
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
88
89
90
91
92
93
  ) COMMENT 'IM 群成员表';
  
  CREATE TABLE IF NOT EXISTS "im_friend" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "user_id" bigint NOT NULL COMMENT '用户编号',
      "friend_user_id" bigint NOT NULL COMMENT '好友用户编号',
14090be6   YunaiV   feat(im):将"免打扰"字段...
94
      "silent" bit DEFAULT FALSE COMMENT '是否免打扰',
96f2d1a1   YunaiV   ✨ feat(friend): 添...
95
      "display_name" varchar(64) NOT NULL DEFAULT '' COMMENT '好友展示备注(仅自己可见)',
479af56a   YunaiV   ✨ feat(im): 增加好友申...
96
97
98
      "add_source" tinyint DEFAULT NULL COMMENT '添加来源',
      "pinned" bit DEFAULT FALSE COMMENT '是否置顶联系人',
      "blocked" bit DEFAULT FALSE COMMENT '是否拉黑',
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
99
100
101
102
103
104
105
106
107
      "status" tinyint NOT NULL COMMENT '好友状态',
      "add_time" timestamp DEFAULT NULL COMMENT '添加好友时间',
      "delete_time" timestamp DEFAULT NULL COMMENT '删除好友时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
f0be7ba1   YunaiV   ✨ feat(im): 优化好友请...
108
109
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_user_friend" UNIQUE ("user_id", "friend_user_id", "tenant_id")
16d5c0b0   YunaiV   ✨ feat(im): 完善单元测试
110
  ) COMMENT 'IM 好友关系表';
479af56a   YunaiV   ✨ feat(im): 增加好友申...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  
  CREATE TABLE IF NOT EXISTS "im_friend_request" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "from_user_id" bigint NOT NULL COMMENT '发起方用户编号',
      "to_user_id" bigint NOT NULL COMMENT '接收方用户编号',
      "handle_result" tinyint NOT NULL DEFAULT 0 COMMENT '处理结果;0未处理;1同意;2拒绝',
      "apply_content" varchar(255) DEFAULT NULL COMMENT '申请理由',
      "handle_content" varchar(255) DEFAULT NULL COMMENT '处理理由',
      "display_name" varchar(64) DEFAULT NULL COMMENT '发起方对接收方的备注',
      "add_source" tinyint DEFAULT NULL COMMENT '添加来源',
      "handle_time" timestamp DEFAULT NULL COMMENT '处理时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
b320e3c1   YunaiV   ✨ feat(im): 初始化群申...
128
129
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_friend_request" UNIQUE ("from_user_id", "to_user_id", "tenant_id")
479af56a   YunaiV   ✨ feat(im): 增加好友申...
130
  ) COMMENT 'IM 好友申请记录表';
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  
  CREATE TABLE IF NOT EXISTS "im_group_request" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "group_id" bigint NOT NULL COMMENT '群编号',
      "user_id" bigint NOT NULL COMMENT '申请人 / 被邀请人用户编号',
      "inviter_user_id" bigint DEFAULT NULL COMMENT '邀请人用户编号;NULL=主动申请;非NULL=被邀请待审批',
      "apply_content" varchar(255) DEFAULT NULL COMMENT '申请理由',
      "add_source" tinyint DEFAULT NULL COMMENT '加入来源',
      "handle_result" tinyint NOT NULL DEFAULT 0 COMMENT '处理结果;0未处理;1同意;2拒绝',
      "handle_user_id" bigint DEFAULT NULL COMMENT '处理人用户编号',
      "handle_content" varchar(255) DEFAULT NULL COMMENT '处理理由',
      "handle_time" timestamp DEFAULT NULL COMMENT '处理时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
b320e3c1   YunaiV   ✨ feat(im): 初始化群申...
149
150
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_group_request" UNIQUE ("group_id", "user_id", "tenant_id")
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
151
152
153
154
155
  ) COMMENT 'IM 加群申请记录表';
  
  CREATE TABLE IF NOT EXISTS "im_face_pack" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "name" varchar(64) NOT NULL COMMENT '表情包名称',
f5bec3ee   YunaiV   ✨ feat(im): 初始化表情...
156
      "icon" varchar(512) DEFAULT NULL COMMENT '表情包图标(面板底部 tab 显示)',
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
      "sort" int NOT NULL DEFAULT 0 COMMENT '排序',
      "status" tinyint NOT NULL COMMENT '状态',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 表情包表';
  
  CREATE TABLE IF NOT EXISTS "im_face_pack_item" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "pack_id" bigint NOT NULL COMMENT '所属表情包编号',
      "url" varchar(512) NOT NULL COMMENT '表情图 URL',
      "name" varchar(64) DEFAULT NULL COMMENT '表情名(可选;如「狗头」「捂脸」)',
      "width" int NOT NULL DEFAULT 0 COMMENT '渲染宽度(像素)',
      "height" int NOT NULL DEFAULT 0 COMMENT '渲染高度(像素)',
      "sort" int NOT NULL DEFAULT 0 COMMENT '排序',
      "status" tinyint NOT NULL COMMENT '状态',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 表情包项表';
  
2fd201bf   YunaiV   ✨ feat(im): 振铃超时 ...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
  CREATE TABLE IF NOT EXISTS "im_rtc_call" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "room" varchar(64) NOT NULL COMMENT '业务通话编号',
      "conversation_type" tinyint NOT NULL COMMENT '会话类型',
      "media_type" tinyint NOT NULL COMMENT '媒体类型',
      "inviter_user_id" bigint NOT NULL COMMENT '发起人用户编号',
      "group_id" bigint DEFAULT NULL COMMENT '群编号',
      "status" tinyint NOT NULL COMMENT '通话状态',
      "end_reason" tinyint DEFAULT NULL COMMENT '结束原因',
      "start_time" timestamp NOT NULL COMMENT '发起时间',
      "accept_time" timestamp DEFAULT NULL COMMENT '接通时间',
      "end_time" timestamp DEFAULT NULL COMMENT '结束时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 通话记录表';
  
  CREATE TABLE IF NOT EXISTS "im_rtc_participant" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
36c44105   YunaiV   ✨ feat(im): 管理后台新...
209
      "call_id" bigint NOT NULL COMMENT '通话编号',
2fd201bf   YunaiV   ✨ feat(im): 振铃超时 ...
210
211
212
213
214
215
216
217
218
219
220
221
222
      "room" varchar(64) NOT NULL COMMENT '业务通话编号',
      "user_id" bigint NOT NULL COMMENT '参与者用户编号',
      "role" tinyint NOT NULL COMMENT '参与角色',
      "status" tinyint NOT NULL COMMENT '参与状态',
      "invite_time" timestamp NOT NULL COMMENT '被邀请时间',
      "accept_time" timestamp DEFAULT NULL COMMENT '接听时间',
      "leave_time" timestamp DEFAULT NULL COMMENT '离开时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
bd29116e   YunaiV   fix: 修复 IM 申请与 RT...
223
224
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_rtc_participant_room_user" UNIQUE ("room", "user_id", "tenant_id")
2fd201bf   YunaiV   ✨ feat(im): 振铃超时 ...
225
226
  ) COMMENT 'IM 通话参与者表';
  
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
227
228
229
230
231
232
233
  CREATE TABLE IF NOT EXISTS "im_face_user_item" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "user_id" bigint NOT NULL COMMENT '所属用户编号',
      "url" varchar(512) NOT NULL COMMENT '表情图 URL',
      "name" varchar(64) DEFAULT NULL COMMENT '表情名(可选)',
      "width" int NOT NULL DEFAULT 0 COMMENT '渲染宽度(像素)',
      "height" int NOT NULL DEFAULT 0 COMMENT '渲染高度(像素)',
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
234
235
236
237
238
239
240
      "sort" int NOT NULL DEFAULT 0 COMMENT '排序',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
f5ef0a89   YunaiV   fix(im): 批量修复 P0 ...
241
242
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_face_user_item_user_url_deleted" UNIQUE ("user_id", "url", "deleted")
9ebf7209   YunaiV   ✨ feat(im): 初始化群申...
243
  ) COMMENT 'IM 用户私有表情表';
6b1a0cfc   YunaiV   ✨ feat(im): 更多单元测试
244
  
611880a3   YunaiV   ✨ feat(im): 新增频道消...
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
  CREATE TABLE IF NOT EXISTS "im_channel" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "code" varchar(64) NOT NULL COMMENT '频道业务码;唯一',
      "name" varchar(64) NOT NULL COMMENT '频道名称',
      "avatar" varchar(512) DEFAULT NULL COMMENT '频道头像',
      "sort" int NOT NULL DEFAULT 0 COMMENT '排序',
      "status" tinyint NOT NULL DEFAULT 0 COMMENT '状态;0 启用 1 停用',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 频道表';
  
  CREATE TABLE IF NOT EXISTS "im_channel_material" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "channel_id" bigint NOT NULL COMMENT '频道编号',
865a58a6   YunaiV   ✨ feat(im): 继续优化频...
264
      "type" tinyint NOT NULL COMMENT '内容类型;1 站内富文本 2 外链',
611880a3   YunaiV   ✨ feat(im): 新增频道消...
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
      "title" varchar(128) NOT NULL COMMENT '标题',
      "cover_url" varchar(512) DEFAULT NULL COMMENT '封面图',
      "summary" varchar(255) DEFAULT NULL COMMENT '摘要',
      "content" clob DEFAULT NULL COMMENT '正文;富文本 HTML',
      "url" varchar(512) DEFAULT NULL COMMENT '跳转链接;为空时点击在客户端内置详情页拉 content;非空则跳 url',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 频道素材表';
  
  CREATE TABLE IF NOT EXISTS "im_channel_message" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "channel_id" bigint NOT NULL COMMENT '频道编号;冗余 im_channel_material.channel_id 便于检索',
      "material_id" bigint NOT NULL COMMENT '关联素材编号',
      "type" smallint NOT NULL COMMENT '消息类型',
      "content" varchar(8192) DEFAULT NULL COMMENT '消息内容;推送时 payload JSON 快照;不含富文本正文',
120e4415   YunaiV   feat(im):清理多余的 TODO
285
      "receiver_user_ids" text DEFAULT NULL COMMENT '接收人编号列表;逗号分隔;为空表示全员',
611880a3   YunaiV   ✨ feat(im): 新增频道消...
286
287
288
289
290
291
292
293
294
295
      "send_time" timestamp NOT NULL COMMENT '发送时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT 'IM 频道消息表';
  
6d8ad0c3   YunaiV   feat(im): 优化消息拉取与...
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
  CREATE TABLE IF NOT EXISTS "im_conversation_read" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "user_id" bigint NOT NULL COMMENT '用户编号',
      "conversation_type" tinyint NOT NULL COMMENT '会话类型',
      "target_id" bigint NOT NULL COMMENT '目标编号',
      "message_id" bigint NOT NULL COMMENT '最大已读消息编号',
      "read_time" timestamp NOT NULL COMMENT '最近已读时间',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_conversation_read_user_target" UNIQUE ("user_id", "conversation_type", "target_id", "tenant_id")
  ) COMMENT 'IM 会话读位置表';
  
513c1301   YunaiV   fix(im):加固群聊与好友部分流程
313
314
315
316
317
318
319
320
321
322
323
324
325
326
  CREATE TABLE IF NOT EXISTS "im_sensitive_word" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
      "word" varchar(128) NOT NULL COMMENT '敏感词',
      "status" tinyint NOT NULL DEFAULT 0 COMMENT '状态;0 启用 1 停用',
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id"),
      CONSTRAINT "uk_im_sensitive_word" UNIQUE ("word", "tenant_id")
  ) COMMENT 'IM 敏感词表';
  
6b1a0cfc   YunaiV   ✨ feat(im): 更多单元测试
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
  CREATE TABLE IF NOT EXISTS "system_users" (
      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
      "username" varchar(30) NOT NULL DEFAULT '',
      "password" varchar(100) NOT NULL DEFAULT '',
      "nickname" varchar(30) NOT NULL DEFAULT '',
      "remark" varchar(500) DEFAULT NULL,
      "dept_id" bigint DEFAULT NULL,
      "post_ids" varchar(255) DEFAULT NULL,
      "email" varchar(50) DEFAULT '',
      "mobile" varchar(11) DEFAULT '',
      "sex" tinyint DEFAULT 0,
      "avatar" varchar(100) DEFAULT '',
      "status" tinyint NOT NULL DEFAULT 0,
      "login_ip" varchar(50) DEFAULT '',
      "login_date" timestamp DEFAULT NULL,
      "creator" varchar(64) DEFAULT '',
      "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "updater" varchar(64) DEFAULT '',
      "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      "deleted" bit NOT NULL DEFAULT FALSE,
      "tenant_id" bigint NOT NULL DEFAULT 0,
      PRIMARY KEY ("id")
  ) COMMENT '用户信息表';