Add 'core/' from commit 'b0dfc4146ca0da535a87f8509aec68817fb2ab14'
git-subtree-dir: core git-subtree-mainline:a07f3dcd23git-subtree-split:b0dfc4146c
This commit is contained in:
66
core/kordophone-db/src/schema.rs
Normal file
66
core/kordophone-db/src/schema.rs
Normal file
@@ -0,0 +1,66 @@
|
||||
// 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,
|
||||
);
|
||||
Reference in New Issue
Block a user