forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: maintain separate master/account settings in SQLite migration
- Update settings migration to maintain separate master and account records - Use activeDid/accountDid pattern to differentiate between settings types: * Master settings: activeDid set, accountDid empty * Account settings: accountDid set, activeDid empty - Add detailed logging for settings migration process - Focus on migrating key fields: firstName, isRegistered, profileImageUrl, showShortcutBvc, and searchBoxes - Fix issue where settings were being incorrectly merged into a single record This change ensures the SQLite database maintains the same settings structure as Dexie, which is required by the existing codebase.
This commit is contained in:
@@ -112,6 +112,15 @@
|
||||
Migrate Accounts
|
||||
</button>
|
||||
|
||||
<button
|
||||
:disabled="isLoading || !isDexieEnabled"
|
||||
class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-pink-600 hover:bg-pink-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-pink-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
@click="testSpecificSettingsMigration"
|
||||
>
|
||||
<IconRenderer icon-name="test" svg-class="-ml-1 mr-3 h-5 w-5" />
|
||||
Test Settings Migration
|
||||
</button>
|
||||
|
||||
<button
|
||||
:disabled="!comparison"
|
||||
class="inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
@@ -798,6 +807,7 @@ import {
|
||||
migrateAccounts,
|
||||
migrateAll,
|
||||
generateComparisonYaml,
|
||||
testSettingsMigration,
|
||||
type DataComparison,
|
||||
type MigrationResult,
|
||||
} from "../services/migrationService";
|
||||
@@ -1214,5 +1224,33 @@ export default class DatabaseMigration extends Vue {
|
||||
this.error = "";
|
||||
this.successMessage = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the specific settings migration for the fields you mentioned
|
||||
*
|
||||
* This method tests the migration of firstName, isRegistered, profileImageUrl,
|
||||
* showShortcutBvc, and searchBoxes from Dexie to SQLite.
|
||||
*
|
||||
* @async
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
async testSpecificSettingsMigration(): Promise<void> {
|
||||
this.setLoading("Testing specific settings migration...");
|
||||
this.clearMessages();
|
||||
|
||||
try {
|
||||
await testSettingsMigration();
|
||||
this.successMessage = "✅ Settings migration test completed successfully! Check the console for detailed logs.";
|
||||
logger.info("[DatabaseMigration] Settings migration test completed successfully");
|
||||
|
||||
// Refresh comparison data after successful test
|
||||
this.comparison = await compareDatabases();
|
||||
} catch (error) {
|
||||
this.error = `Settings migration test failed: ${error}`;
|
||||
logger.error("[DatabaseMigration] Settings migration test failed:", error);
|
||||
} finally {
|
||||
this.setLoading("");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user