Private
Public Access
1
0
Files
Kordophone/kordophone-db/src/schema.rs

66 lines
1.8 KiB
Rust
Raw Normal View History

// When this file changes, run the following command to generate a new migration:
// DATABASE_URL=/tmp/db.sql diesel migration generate --diff-schema create_conversations
diesel::table! {
conversations (id) {
id -> Text,
unread_count -> BigInt,
display_name -> Nullable<Text>,
last_message_preview -> Nullable<Text>,
date -> Timestamp,
}
}
diesel::table! {
participants (id) {
id -> Integer,
display_name -> Nullable<Text>,
is_me -> Bool,
2025-06-26 16:23:53 -07:00
contact_id -> Nullable<Text>,
}
}
diesel::table! {
conversation_participants (conversation_id, participant_id) {
conversation_id -> Text,
participant_id -> Integer,
}
}
diesel::table! {
messages (id) {
2025-06-06 16:39:31 -07:00
id -> Text, // guid
text -> Text,
sender_participant_id -> Nullable<Integer>,
date -> Timestamp,
file_transfer_guids -> Nullable<Text>, // JSON array of file transfer GUIDs
attachment_metadata -> Nullable<Text>, // JSON string of attachment metadata
}
}
diesel::table! {
conversation_messages (conversation_id, message_id) {
conversation_id -> Text, // guid
message_id -> Text, // guid
}
}
diesel::table! {
settings (key) {
key -> Text,
value -> Binary,
}
}
diesel::joinable!(conversation_participants -> conversations (conversation_id));
diesel::joinable!(conversation_participants -> participants (participant_id));
2025-06-06 16:39:31 -07:00
diesel::allow_tables_to_appear_in_same_query!(
conversations,
participants,
conversation_participants
);
diesel::joinable!(conversation_messages -> conversations (conversation_id));
diesel::joinable!(conversation_messages -> messages (message_id));
2025-06-06 16:39:31 -07:00
diesel::allow_tables_to_appear_in_same_query!(conversations, messages, conversation_messages);