Skip to content

Commit 5672a5a

Browse files
committed
Log the migration
1 parent 3d82d83 commit 5672a5a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/storage/RustSdkCryptoStorageProvider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { StoreType as RustSdkCryptoStoreType } from "@matrix-org/matrix-sdk-cryp
1111
import { ICryptoStorageProvider } from "./ICryptoStorageProvider";
1212
import { IAppserviceCryptoStorageProvider } from "./IAppserviceStorageProvider";
1313
import { ICryptoRoomInformation } from "../e2ee/ICryptoRoomInformation";
14+
import { LogService } from "../logging/LogService";
1415

1516
export { RustSdkCryptoStoreType };
1617

@@ -59,10 +60,12 @@ export class RustSdkCryptoStorageProvider implements ICryptoStorageProvider {
5960
// No machine files at all, we can skip.
6061
return newPath;
6162
}
62-
63+
const legacyDeviceId = await this.getDeviceId();
6364
// We need to move the file.
64-
await mkdir(newPath);
65-
await rename(legacyFilePath, path.join(newPath, 'matrix-sdk-crypto.sqlite3'));
65+
const previousDevicePath = path.join(this.storagePath, sha256().update(legacyDeviceId).digest('hex'));
66+
LogService.warn("RustSdkCryptoStorageProvider", `Migrating path for SDK database for legacy device ${legacyDeviceId}`);
67+
await mkdir(previousDevicePath);
68+
await rename(legacyFilePath, path.join(previousDevicePath, 'matrix-sdk-crypto.sqlite3'));
6669
return newPath;
6770
}
6871

0 commit comments

Comments
 (0)