IndexedDB migration: fix settings update

This commit is contained in:
2025-06-19 18:12:56 -06:00
parent 37f2ba1382
commit 2e34d31594
2 changed files with 66 additions and 52 deletions

View File

@@ -19,8 +19,9 @@
</a>
</div>
<!-- Migration Options -->
<!--
<div class="mt-4">
<!-- Migration Options -->
<div class="bg-white shadow rounded-lg">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-lg leading-6 font-medium text-gray-900 mb-4">
@@ -52,6 +53,7 @@
</div>
</div>
</div>
-->
<div
class="text-lg leading-6 font-medium text-red-900 mt-4"
@@ -59,7 +61,7 @@
<p
v-if="comparison && (comparison.sqliteAccounts.length > 1 || comparison.sqliteSettings.length > 1 || comparison.sqliteContacts.length > 0)"
>
Beware: you have unexpected existing data in the SQLite database that will be overwritten. Talk with Trent.
Beware: you have unexpected existing data in the new database that will be overwritten. Talk with Trent.
</p>
<p
v-if="cannotfindMainAccount"
@@ -951,7 +953,6 @@ import { Router } from "vue-router";
import IconRenderer from "../components/IconRenderer.vue";
import {
compareDatabases,
migrateContacts,
migrateSettings,
migrateAccounts,
migrateAll,
@@ -1004,7 +1005,6 @@ export default class DatabaseMigration extends Vue {
private loadingMessage = "";
private error = "";
private exportedData: Record<string, any> | null = null;
private overwriteExisting = true;
private successMessage = "";
useClipboard = useClipboard;
@@ -1075,7 +1075,7 @@ export default class DatabaseMigration extends Vue {
window.alert('Copied to clipboard!');
}
} catch (error) {
console.error('Failed to copy to clipboard:', error);
logger.error('Failed to copy to clipboard:', error);
if (typeof window !== 'undefined') {
window.alert('Failed to copy to clipboard');
}
@@ -1141,7 +1141,7 @@ export default class DatabaseMigration extends Vue {
this.clearMessages();
try {
const result: MigrationResult = await migrateAll(this.overwriteExisting);
const result: MigrationResult = await migrateAll();
if (result.success) {
const totalMigrated =
@@ -1209,8 +1209,7 @@ export default class DatabaseMigration extends Vue {
/**
* Migrates contacts from Dexie to SQLite database
*
* This method transfers contacts from the Dexie database to SQLite,
* with options to overwrite existing records.
* This method transfers contacts from the Dexie database to SQLite.
*
* @async
* @returns {Promise<void>}
@@ -1230,8 +1229,7 @@ export default class DatabaseMigration extends Vue {
/**
* Migrates settings from Dexie to SQLite database
*
* This method transfers settings from the Dexie database to SQLite,
* with options to overwrite existing records.
* This method transfers settings from the Dexie database to SQLite.
*
* @async
* @returns {Promise<void>}
@@ -1241,9 +1239,7 @@ export default class DatabaseMigration extends Vue {
this.clearMessages();
try {
const result: MigrationResult = await migrateSettings(
this.overwriteExisting,
);
const result: MigrationResult = await migrateSettings();
if (result.success) {
this.successMessage = `Successfully migrated ${result.settingsMigrated} settings.`;
@@ -1276,8 +1272,7 @@ export default class DatabaseMigration extends Vue {
* Migrates accounts from Dexie to SQLite database
*
* This method transfers accounts from the Dexie database to SQLite,
* with options to overwrite existing records. For accounts with mnemonic
* data, it uses the importFromMnemonic utility for proper key derivation.
* For accounts with mnemonic data, it uses the importFromMnemonic utility for proper key derivation.
*
* @async
* @returns {Promise<void>}