signal-desktop/ts/sql/migrations/86-story-replies-index.ts

17 lines
552 B
TypeScript
Raw Normal View History

// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2025-03-12 14:45:54 -07:00
import type { Database } from '@signalapp/sqlcipher';
2025-08-06 10:32:08 -07:00
export default function updateToSchemaVersion86(db: Database): void {
// The key reason for this new schema is that all of our previous schemas start with
// conversationId. This query is meant to find all replies to a given story, no
// matter the conversation.
db.exec(
`CREATE INDEX messages_story_replies
ON messages (storyId, received_at, sent_at)
WHERE isStory IS 0;
`
);
}