kordophone-db: adds support for the Messages table
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
// 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,
|
||||
@@ -11,7 +14,8 @@ diesel::table! {
|
||||
diesel::table! {
|
||||
participants (id) {
|
||||
id -> Integer,
|
||||
display_name -> Text,
|
||||
display_name -> Nullable<Text>,
|
||||
is_me -> Bool,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +26,26 @@ diesel::table! {
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
messages (id) {
|
||||
id -> Text, // guid
|
||||
text -> Text,
|
||||
sender_participant_id -> Nullable<Integer>,
|
||||
date -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
diesel::table! {
|
||||
conversation_messages (conversation_id, message_id) {
|
||||
conversation_id -> Text, // guid
|
||||
message_id -> Text, // guid
|
||||
}
|
||||
}
|
||||
|
||||
diesel::joinable!(conversation_participants -> conversations (conversation_id));
|
||||
diesel::joinable!(conversation_participants -> participants (participant_id));
|
||||
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));
|
||||
diesel::allow_tables_to_appear_in_same_query!(conversations, messages, conversation_messages);
|
||||
Reference in New Issue
Block a user