eraseAllStorageServiceState: Delete everything, delete in memory
This commit is contained in:
parent
b7b725f74c
commit
90f0f8e255
7 changed files with 143 additions and 36 deletions
|
@ -249,7 +249,6 @@ const dataInterface: ServerInterface = {
|
|||
removeAllSessions,
|
||||
getAllSessions,
|
||||
|
||||
eraseStorageServiceStateFromConversations,
|
||||
getConversationCount,
|
||||
saveConversation,
|
||||
saveConversations,
|
||||
|
@ -384,6 +383,7 @@ const dataInterface: ServerInterface = {
|
|||
|
||||
removeAll,
|
||||
removeAllConfiguration,
|
||||
eraseStorageServiceState,
|
||||
|
||||
getMessagesNeedingUpgrade,
|
||||
getMessagesWithVisualMediaAttachments,
|
||||
|
@ -1621,18 +1621,6 @@ async function getConversationById(
|
|||
return jsonToObject(row.json);
|
||||
}
|
||||
|
||||
async function eraseStorageServiceStateFromConversations(): Promise<void> {
|
||||
const db = getInstance();
|
||||
|
||||
db.prepare<EmptyQuery>(
|
||||
`
|
||||
UPDATE conversations
|
||||
SET
|
||||
json = json_remove(json, '$.storageID', '$.needsStorageServiceSync', '$.unknownFields', '$.storageProfileKey');
|
||||
`
|
||||
).run();
|
||||
}
|
||||
|
||||
function getAllConversationsSync(db = getInstance()): Array<ConversationType> {
|
||||
const rows: ConversationRows = db
|
||||
.prepare<EmptyQuery>(
|
||||
|
@ -5583,6 +5571,40 @@ async function removeAllConfiguration(
|
|||
})();
|
||||
}
|
||||
|
||||
async function eraseStorageServiceState(): Promise<void> {
|
||||
const db = getInstance();
|
||||
|
||||
db.exec(`
|
||||
-- Conversations
|
||||
UPDATE conversations
|
||||
SET
|
||||
json = json_remove(json, '$.storageID', '$.needsStorageServiceSync', '$.storageUnknownFields');
|
||||
|
||||
-- Stickers
|
||||
UPDATE sticker_packs
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
|
||||
UPDATE uninstalled_sticker_packs
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
|
||||
-- Story Distribution Lists
|
||||
UPDATE storyDistributions
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
`);
|
||||
}
|
||||
|
||||
const MAX_MESSAGE_MIGRATION_ATTEMPTS = 5;
|
||||
|
||||
async function getMessagesNeedingUpgrade(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue