mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-08-04 20:34:21 +01:00
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:
@@ -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}`);
|
||||
})();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user