mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-17 15:23:36 +01:00
Support pollTerminateNotification in backups
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
// Copyright 2026 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1690(
|
||||
db: WritableDB,
|
||||
logger: LoggerType
|
||||
): void {
|
||||
const [query, params] = sql`
|
||||
UPDATE messages AS message
|
||||
SET json = json_remove(
|
||||
json_set(
|
||||
message.json,
|
||||
'$.pollTerminateNotification.pollTimestamp',
|
||||
COALESCE(
|
||||
(
|
||||
SELECT poll.timestamp
|
||||
FROM messages AS poll
|
||||
WHERE poll.id = message.json ->> '$.pollTerminateNotification.pollMessageId'
|
||||
),
|
||||
0
|
||||
)
|
||||
),
|
||||
'$.pollTerminateNotification.pollMessageId'
|
||||
)
|
||||
WHERE
|
||||
message.type IS 'poll-terminate' AND
|
||||
message.json -> '$.pollTerminateNotification' IS NOT NULL;
|
||||
`;
|
||||
|
||||
const result = db.prepare(query).run(params);
|
||||
|
||||
logger.info(`Updated ${result.changes} poll terminate notifications`);
|
||||
}
|
||||
@@ -145,6 +145,7 @@ import updateToSchemaVersion1650 from './1650-protected-attachments.std.js';
|
||||
import updateToSchemaVersion1660 from './1660-protected-attachments-non-unique.std.js';
|
||||
import updateToSchemaVersion1670 from './1670-drop-call-link-epoch.std.js';
|
||||
import updateToSchemaVersion1680 from './1680-cleanup-empty-strings.std.js';
|
||||
import updateToSchemaVersion1690 from './1690-poll-terminate-notification-timestamp.std.js';
|
||||
|
||||
import { DataWriter } from '../Server.node.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
@@ -1652,6 +1653,7 @@ export const SCHEMA_VERSIONS: ReadonlyArray<SchemaUpdateType> = [
|
||||
{ version: 1660, update: updateToSchemaVersion1660 },
|
||||
{ version: 1670, update: updateToSchemaVersion1670 },
|
||||
{ version: 1680, update: updateToSchemaVersion1680 },
|
||||
{ version: 1690, update: updateToSchemaVersion1690 },
|
||||
];
|
||||
|
||||
export class DBVersionFromFutureError extends Error {
|
||||
|
||||
Reference in New Issue
Block a user