Data storage improvements after deleting and leaving a group

Co-authored-by: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com>
This commit is contained in:
Scott Nonnenberg
2026-07-22 04:38:31 +10:00
committed by GitHub
parent 5fb6ce2f89
commit 8efd06f9d8
19 changed files with 1253 additions and 69 deletions
+8 -2
View File
@@ -1,6 +1,8 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { cwd } from 'node:process';
import lodash from 'lodash';
import SQL from '@signalapp/sqlcipher';
@@ -17,7 +19,11 @@ export function createDB(): WritableDB {
return db;
}
export function updateToVersion(db: WritableDB, version: number): void {
export function updateToVersion(
db: WritableDB,
version: number,
data: { userDataPath: string } = { userDataPath: cwd() }
): void {
const startVersion = db.pragma('user_version', { simple: true }) as number;
if (startVersion === version) {
return;
@@ -34,7 +40,7 @@ export function updateToVersion(db: WritableDB, version: number): void {
}
db.transaction(() => {
update(db, silentLogger, startVersion);
update(db, silentLogger, startVersion, data);
db.pragma(`user_version = ${version}`);
})();