getUnreadByConversationAndMarkRead: Only query incoming messages
This commit is contained in:
parent
ecdc583f2a
commit
d753fe8fcb
3 changed files with 81 additions and 2 deletions
39
ts/sql/migrations/59-update-expiring-index.ts
Normal file
39
ts/sql/migrations/59-update-expiring-index.ts
Normal file
|
@ -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!');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue