-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getUnreadByConversationAndMarkRead: Only query incoming messages
- Loading branch information
1 parent
ecdc583
commit d753fe8
Showing
3 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2021-2022 Signal Messenger, LLC | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
import type { Database } from 'better-sqlite3'; | ||
|
||
import type { LoggerType } from '../../types/Logging'; | ||
|
||
export default function updateToSchemaVersion59( | ||
currentVersion: number, | ||
db: Database, | ||
logger: LoggerType | ||
): void { | ||
if (currentVersion >= 59) { | ||
return; | ||
} | ||
|
||
db.transaction(() => { | ||
db.exec( | ||
` | ||
DROP INDEX expiring_message_by_conversation_and_received_at; | ||
CREATE INDEX expiring_message_by_conversation_and_received_at | ||
ON messages | ||
( | ||
conversationId, | ||
storyId | ||
expirationStartTimestamp, | ||
expireTimer, | ||
received_at, | ||
) | ||
WHERE isStory IS 0 AND type IS 'incoming'; | ||
` | ||
); | ||
|
||
db.pragma('user_version = 59'); | ||
})(); | ||
|
||
logger.info('updateToSchemaVersion59: success!'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters