signal-desktop/ts/sql/migrations/72-optimize-call-id-message-lookup.ts

24 lines
631 B
TypeScript
Raw Normal View History

2023-01-09 16:52:01 -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';
2023-01-09 16:52:01 -08:00
2025-08-06 10:32:08 -07:00
export default function updateToSchemaVersion72(db: Database): void {
db.exec(
`
ALTER TABLE messages
ADD COLUMN callId TEXT
GENERATED ALWAYS AS (
json_extract(json, '$.callHistoryDetails.callId')
);
ALTER TABLE messages
ADD COLUMN callMode TEXT
GENERATED ALWAYS AS (
json_extract(json, '$.callHistoryDetails.callMode')
);
CREATE INDEX messages_call ON messages
(conversationId, type, callMode, callId);
`
);
2023-01-09 16:52:01 -08:00
}