Private
Public Access
1
0

Don't overwrite already resolved participants, better naming of keys

This commit is contained in:
2025-06-26 18:23:15 -07:00
parent bb19db17cd
commit f6bb1a9b57
25 changed files with 263 additions and 306 deletions

View File

@@ -12,18 +12,17 @@ diesel::table! {
}
diesel::table! {
participants (id) {
id -> Integer,
display_name -> Nullable<Text>,
participants (handle) {
handle -> Text,
is_me -> Bool,
contact_id -> Nullable<Text>,
}
}
diesel::table! {
conversation_participants (conversation_id, participant_id) {
conversation_participants (conversation_id, participant_handle) {
conversation_id -> Text,
participant_id -> Integer,
participant_handle -> Text,
}
}
@@ -31,7 +30,7 @@ diesel::table! {
messages (id) {
id -> Text, // guid
text -> Text,
sender_participant_id -> Nullable<Integer>,
sender_participant_handle -> Nullable<Text>,
date -> Timestamp,
file_transfer_guids -> Nullable<Text>, // JSON array of file transfer GUIDs
attachment_metadata -> Nullable<Text>, // JSON string of attachment metadata
@@ -53,13 +52,15 @@ diesel::table! {
}
diesel::joinable!(conversation_participants -> conversations (conversation_id));
diesel::joinable!(conversation_participants -> participants (participant_id));
diesel::joinable!(conversation_participants -> participants (participant_handle));
diesel::joinable!(messages -> participants (sender_participant_handle));
diesel::joinable!(conversation_messages -> conversations (conversation_id));
diesel::joinable!(conversation_messages -> messages (message_id));
diesel::allow_tables_to_appear_in_same_query!(
conversations,
participants,
conversation_participants
conversation_participants,
messages,
conversation_messages,
settings,
);
diesel::joinable!(conversation_messages -> conversations (conversation_id));
diesel::joinable!(conversation_messages -> messages (message_id));
diesel::allow_tables_to_appear_in_same_query!(conversations, messages, conversation_messages);