Fix call history read syncs
This commit is contained in:
parent
688de5a99b
commit
5a5b681b51
7 changed files with 187 additions and 46 deletions
29
ts/sql/migrations/1170-update-call-history-unread-index.ts
Normal file
29
ts/sql/migrations/1170-update-call-history-unread-index.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/better-sqlite3';
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
import { sql } from '../util';
|
||||
|
||||
export const version = 1170;
|
||||
export function updateToSchemaVersion1170(
|
||||
currentVersion: number,
|
||||
db: Database,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 1170) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
const [query] = sql`
|
||||
DROP INDEX IF EXISTS messages_callHistory_markReadBefore;
|
||||
CREATE INDEX messages_callHistory_markReadBefore
|
||||
ON messages (type, seenStatus, received_at DESC)
|
||||
WHERE type IS 'call-history';
|
||||
`;
|
||||
db.exec(query);
|
||||
|
||||
db.pragma('user_version = 1170');
|
||||
})();
|
||||
logger.info('updateToSchemaVersion1170: success!');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue