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!');
|
||||
}
|
|
@ -92,10 +92,11 @@ import { updateToSchemaVersion1120 } from './1120-messages-foreign-keys-indexes'
|
|||
import { updateToSchemaVersion1130 } from './1130-isStory-index';
|
||||
import { updateToSchemaVersion1140 } from './1140-call-links-deleted-column';
|
||||
import { updateToSchemaVersion1150 } from './1150-expire-timer-version';
|
||||
import { updateToSchemaVersion1160 } from './1160-optimize-calls-unread-count';
|
||||
import {
|
||||
updateToSchemaVersion1160,
|
||||
updateToSchemaVersion1170,
|
||||
version as MAX_VERSION,
|
||||
} from './1160-optimize-calls-unread-count';
|
||||
} from './1170-update-call-history-unread-index';
|
||||
|
||||
function updateToSchemaVersion1(
|
||||
currentVersion: number,
|
||||
|
@ -2056,6 +2057,7 @@ export const SCHEMA_VERSIONS = [
|
|||
updateToSchemaVersion1140,
|
||||
updateToSchemaVersion1150,
|
||||
updateToSchemaVersion1160,
|
||||
updateToSchemaVersion1170,
|
||||
];
|
||||
|
||||
export class DBVersionFromFutureError extends Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue