mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-25 04:36:46 +00:00
Fix handling of encrypted unprocessed envelopes
This commit is contained in:
38
ts/sql/migrations/1320-unprocessed-received-at-date.ts
Normal file
38
ts/sql/migrations/1320-unprocessed-received-at-date.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging';
|
||||
import { sql } from '../util';
|
||||
import type { WritableDB } from '../Interface';
|
||||
|
||||
export const version = 1320;
|
||||
|
||||
export function updateToSchemaVersion1320(
|
||||
currentVersion: number,
|
||||
db: WritableDB,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
if (currentVersion >= 1320) {
|
||||
return;
|
||||
}
|
||||
|
||||
db.transaction(() => {
|
||||
const [query] = sql`
|
||||
DROP INDEX unprocessed_timestamp;
|
||||
|
||||
ALTER TABLE unprocessed
|
||||
ADD COLUMN receivedAtDate INTEGER DEFAULT 0 NOT NULL;
|
||||
|
||||
UPDATE unprocessed
|
||||
SET receivedAtDate = timestamp;
|
||||
|
||||
CREATE INDEX unprocessed_byReceivedAtDate ON unprocessed
|
||||
(receivedAtDate);
|
||||
`;
|
||||
db.exec(query);
|
||||
|
||||
db.pragma('user_version = 1320');
|
||||
})();
|
||||
|
||||
logger.info('updateToSchemaVersion1320: success!');
|
||||
}
|
||||
Reference in New Issue
Block a user