signal-desktop/ts/sql/migrations/49-fix-preview-index.ts

18 lines
555 B
TypeScript
Raw Normal View History

2022-01-07 11:51:41 -08:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2025-03-12 14:45:54 -07:00
import type { Database } from '@signalapp/sqlcipher';
2022-01-07 11:51:41 -08:00
2025-08-06 10:32:08 -07:00
export default function updateToSchemaVersion49(db: Database): void {
db.exec(
`
DROP INDEX messages_preview;
2022-01-07 11:51:41 -08:00
2025-08-06 10:32:08 -07:00
-- Note the omitted 'expiresAt' column in the index. If it is present
-- sqlite can't ORDER BY received_at, sent_at using this index.
CREATE INDEX messages_preview ON messages
(conversationId, shouldAffectPreview, isGroupLeaveEventFromOther, received_at, sent_at);
`
);
2022-01-07 11:51:41 -08:00
}