Support for local deletes synced to all your devices

This commit is contained in:
Scott Nonnenberg 2024-05-29 01:56:00 +10:00 committed by GitHub
parent 06f71a7ef8
commit 11eb1782a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 2094 additions and 72 deletions

View file

@ -0,0 +1,56 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Database } from '@signalapp/better-sqlite3';
import type { LoggerType } from '../../types/Logging';
export const version = 1060;
export function updateToSchemaVersion1060(
currentVersion: number,
db: Database,
logger: LoggerType
): void {
if (currentVersion >= 1060) {
return;
}
db.transaction(() => {
db.exec(`
ALTER TABLE messages
ADD COLUMN isAddressableMessage INTEGER
GENERATED ALWAYS AS (
type IS NULL
OR
type IN (
'incoming',
'outgoing'
)
);
CREATE INDEX messages_by_date_addressable
ON messages (
conversationId, isAddressableMessage, received_at, sent_at
);
CREATE TABLE syncTasks(
id TEXT PRIMARY KEY NOT NULL,
attempts INTEGER NOT NULL,
createdAt INTEGER NOT NULL,
data TEXT NOT NULL,
envelopeId TEXT NOT NULL,
sentAt INTEGER NOT NULL,
type TEXT NOT NULL
) STRICT;
CREATE INDEX syncTasks_order ON syncTasks (
createdAt, sentAt, id
)
`);
})();
db.pragma('user_version = 1060');
logger.info('updateToSchemaVersion1060: success!');
}