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

67 lines
1.8 KiB
Rust

// 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 (handle) {
handle -> Text,
is_me -> Bool,
contact_id -> Nullable<Text>,
}
}
diesel::table! {
conversation_participants (conversation_id, participant_handle) {
conversation_id -> Text,
participant_handle -> Text,
}
}
diesel::table! {
messages (id) {
id -> Text, // guid
text -> Text,
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
}
}
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_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,
messages,
conversation_messages,
settings,
);