@@ -7,6 +7,7 @@ table agents {
77 avatar text
88 background_color text
99 plugins jsonb [default: `[]`]
10+ client_id text
1011 user_id text [not null]
1112 chat_config jsonb
1213 few_shots jsonb
@@ -18,6 +19,10 @@ table agents {
1819 accessed_at "timestamp with time zone" [not null, default: `now()`]
1920 created_at "timestamp with time zone" [not null, default: `now()`]
2021 updated_at "timestamp with time zone" [not null, default: `now()`]
22+
23+ indexes {
24+ (client_id, user_id) [name: 'client_id_user_id_unique', unique]
25+ }
2126}
2227
2328table agents_files {
@@ -116,6 +121,7 @@ table files {
116121 name text [not null]
117122 size integer [not null]
118123 url text [not null]
124+ client_id text
119125 metadata jsonb
120126 chunk_task_id uuid
121127 embedding_task_id uuid
@@ -125,6 +131,7 @@ table files {
125131
126132 indexes {
127133 file_hash [name: 'file_hash_idx']
134+ (client_id, user_id) [name: 'files_client_id_user_id_unique', unique]
128135 }
129136}
130137
@@ -157,11 +164,16 @@ table knowledge_bases {
157164 avatar text
158165 type text
159166 user_id text [not null]
167+ client_id text
160168 is_public boolean [default: false]
161169 settings jsonb
162170 accessed_at "timestamp with time zone" [not null, default: `now()`]
163171 created_at "timestamp with time zone" [not null, default: `now()`]
164172 updated_at "timestamp with time zone" [not null, default: `now()`]
173+
174+ indexes {
175+ (client_id, user_id) [name: 'knowledge_bases_client_id_user_id_unique', unique]
176+ }
165177}
166178
167179table message_chunks {
@@ -183,16 +195,26 @@ table message_plugins {
183195 identifier text
184196 state jsonb
185197 error jsonb
198+ client_id text
186199 user_id text [not null]
200+
201+ indexes {
202+ (client_id, user_id) [name: 'message_plugins_client_id_user_id_unique', unique]
203+ }
187204}
188205
189206table message_queries {
190207 id uuid [pk, not null, default: `gen_random_uuid()`]
191208 message_id text [not null]
192209 rewrite_query text
193210 user_query text
211+ client_id text
194212 user_id text [not null]
195213 embeddings_id uuid
214+
215+ indexes {
216+ (client_id, user_id) [name: 'message_queries_client_id_user_id_unique', unique]
217+ }
196218}
197219
198220table message_query_chunks {
@@ -212,15 +234,25 @@ table message_tts {
212234 content_md5 text
213235 file_id text
214236 voice text
237+ client_id text
215238 user_id text [not null]
239+
240+ indexes {
241+ (client_id, user_id) [name: 'message_tts_client_id_user_id_unique', unique]
242+ }
216243}
217244
218245table message_translates {
219246 id text [pk, not null]
220247 content text
221248 from text
222249 to text
250+ client_id text
223251 user_id text [not null]
252+
253+ indexes {
254+ (client_id, user_id) [name: 'message_translates_client_id_user_id_unique', unique]
255+ }
224256}
225257
226258table messages {
@@ -324,18 +356,28 @@ table chunks {
324356 metadata jsonb
325357 index integer
326358 type varchar
359+ client_id text
327360 user_id text
328361 accessed_at "timestamp with time zone" [not null, default: `now()`]
329362 created_at "timestamp with time zone" [not null, default: `now()`]
330363 updated_at "timestamp with time zone" [not null, default: `now()`]
364+
365+ indexes {
366+ (client_id, user_id) [name: 'chunks_client_id_user_id_unique', unique]
367+ }
331368}
332369
333370table embeddings {
334371 id uuid [pk, not null, default: `gen_random_uuid()`]
335372 chunk_id uuid [unique]
336373 embeddings vector(1024)
337374 model text
375+ client_id text
338376 user_id text
377+
378+ indexes {
379+ (client_id, user_id) [name: 'embeddings_client_id_user_id_unique', unique]
380+ }
339381}
340382
341383table unstructured_chunks {
@@ -349,8 +391,13 @@ table unstructured_chunks {
349391 updated_at "timestamp with time zone" [not null, default: `now()`]
350392 parent_id varchar
351393 composite_id uuid
394+ client_id text
352395 user_id text
353396 file_id varchar
397+
398+ indexes {
399+ (client_id, user_id) [name: 'unstructured_chunks_client_id_user_id_unique', unique]
400+ }
354401}
355402
356403table rag_eval_dataset_records {
@@ -456,7 +503,7 @@ table session_groups {
456503 updated_at "timestamp with time zone" [not null, default: `now()`]
457504
458505 indexes {
459- (client_id, user_id) [name: 'session_group_client_id_user_unique ', unique]
506+ (client_id, user_id) [name: 'session_groups_client_id_user_id_unique ', unique]
460507 }
461508}
462509
@@ -490,11 +537,16 @@ table threads {
490537 topic_id text [not null]
491538 source_message_id text [not null]
492539 parent_thread_id text
540+ client_id text
493541 user_id text [not null]
494542 last_active_at "timestamp with time zone" [default: `now()`]
495543 accessed_at "timestamp with time zone" [not null, default: `now()`]
496544 created_at "timestamp with time zone" [not null, default: `now()`]
497545 updated_at "timestamp with time zone" [not null, default: `now()`]
546+
547+ indexes {
548+ (client_id, user_id) [name: 'threads_client_id_user_id_unique', unique]
549+ }
498550}
499551
500552table topics {
@@ -511,7 +563,7 @@ table topics {
511563 updated_at "timestamp with time zone" [not null, default: `now()`]
512564
513565 indexes {
514- (client_id, user_id) [name: 'topic_client_id_user_id_unique ', unique]
566+ (client_id, user_id) [name: 'topics_client_id_user_id_unique ', unique]
515567 }
516568}
517569
0 commit comments