Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: location messages backup (WPB-5826) #2324

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,24 @@ INSERT INTO Receipt
OR selfdelete_message_id.conversation_id IS NULL;

INSERT INTO ButtonContent SELECT * FROM local_db.ButtonContent;

WITH selfdelete_message_id AS (
SELECT local_db.Message.id, local_db.Message.conversation_id
FROM local_db.Message
WHERE local_db.Message.expire_after_millis IS NOT NULL
)
INSERT INTO MessageConversationLocationContent
SELECT local_db.MessageConversationLocationContent.message_id,
local_db.MessageConversationLocationContent.conversation_id,
local_db.MessageConversationLocationContent.latitude,
local_db.MessageConversationLocationContent.longitude,
local_db.MessageConversationLocationContent.name,
local_db.MessageConversationLocationContent.zoom
FROM local_db.MessageConversationLocationContent
LEFT JOIN selfdelete_message_id
ON local_db.MessageConversationLocationContent.message_id = selfdelete_message_id.id
AND local_db.MessageConversationLocationContent.conversation_id = selfdelete_message_id.conversation_id
WHERE selfdelete_message_id.id IS NULL
OR selfdelete_message_id.conversation_id IS NULL;

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,6 @@ INSERT OR IGNORE INTO Receipt SELECT * FROM backup_db.Receipt;

importCompositeButtons:
INSERT OR IGNORE INTO ButtonContent SELECT * FROM backup_db.ButtonContent;

importMessageLocationContentTable:
INSERT OR IGNORE INTO MessageConversationLocationContent SELECT * FROM backup_db.MessageConversationLocationContent;
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ markMessageAsDeleted {
DELETE FROM MessageMemberChangeContent WHERE message_id = :message_id AND conversation_id = :conversation_id;
DELETE FROM MessageUnknownContent WHERE message_id = :message_id AND conversation_id = :conversation_id;
DELETE FROM MessageRestrictedAssetContent WHERE message_id = :message_id AND conversation_id = :conversation_id;
DELETE FROM MessageConversationLocationContent WHERE message_id = :message_id AND conversation_id = :conversation_id;
-- deleted messages will not have a quote 100%
-- TODO: why inserting a NULL here? Shouldn't we just not insert anything?
INSERT INTO MessageTextContent(message_id, conversation_id, text_body, is_quoting_self) VALUES(:message_id, :conversation_id, NULL, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ internal class DatabaseImporterImpl internal constructor(
importReactionTable()
importReceiptTable()
importCompositeButtons()
importMessageLocationContentTable()
}
}
}
Expand Down
Loading