2021-12-15 00:17:14 -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';
|
2021-12-15 00:17:14 -08:00
|
|
|
|
2025-08-06 10:32:08 -07:00
|
|
|
export default function updateToSchemaVersion46(db: Database): void {
|
|
|
|
db.exec(
|
|
|
|
`
|
|
|
|
--- Add column to messages table
|
|
|
|
|
|
|
|
ALTER TABLE messages
|
|
|
|
ADD COLUMN
|
|
|
|
isStory INTEGER
|
|
|
|
GENERATED ALWAYS
|
|
|
|
AS (type = 'story');
|
|
|
|
|
|
|
|
--- Update important message indices
|
|
|
|
|
|
|
|
DROP INDEX messages_conversation;
|
|
|
|
CREATE INDEX messages_conversation ON messages
|
|
|
|
(conversationId, isStory, storyId, received_at, sent_at);
|
|
|
|
`
|
|
|
|
);
|
2021-12-15 00:17:14 -08:00
|
|
|
}
|