2022-01-07 12:51:19 -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 12:51:19 -08:00
|
|
|
|
2025-08-06 10:32:08 -07:00
|
|
|
export default function updateToSchemaVersion50(db: Database): void {
|
|
|
|
db.exec(
|
|
|
|
`
|
|
|
|
DROP INDEX messages_unread;
|
2022-01-07 12:51:19 -08:00
|
|
|
|
2025-08-06 10:32:08 -07:00
|
|
|
-- Note: here we move to the modern isStory/storyId fields and add received_at/sent_at.
|
|
|
|
CREATE INDEX messages_unread ON messages
|
|
|
|
(conversationId, readStatus, isStory, storyId, received_at, sent_at) WHERE readStatus IS NOT NULL;
|
|
|
|
`
|
|
|
|
);
|
2022-01-07 12:51:19 -08:00
|
|
|
}
|