forked from jsnbuchanan/crowd-funder-for-time-pwa
WIP: restore database migration system and improve error handling
- Restore runMigrations functionality for database schema migrations - Remove indexedDBMigrationService.ts (was for IndexedDB to SQLite migration) - Recreate migrationService.ts and db-sql/migration.ts for schema management - Add proper TypeScript error handling with type guards in AccountViewView - Fix CreateAndSubmitClaimResult property access in QuickActionBvcBeginView - Remove LeafletMouseEvent from Vue components array (it's a type, not component) - Add null check for UserNameDialog callback to prevent undefined assignment - Implement extractErrorMessage helper function for consistent error handling - Update router to remove database-migration route The migration system now properly handles database schema evolution across app versions, while the IndexedDB to SQLite migration service has been removed as it was specific to that one-time migration.
This commit is contained in:
@@ -200,12 +200,7 @@ import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import EntityIcon from "../components/EntityIcon.vue";
|
||||
import OfferDialog from "../components/OfferDialog.vue";
|
||||
import {
|
||||
APP_SERVER,
|
||||
AppString,
|
||||
NotificationIface,
|
||||
USE_DEXIE_DB,
|
||||
} from "../constants/app";
|
||||
import { APP_SERVER, AppString, NotificationIface } from "../constants/app";
|
||||
import {
|
||||
db,
|
||||
logConsoleAndDb,
|
||||
@@ -415,10 +410,7 @@ export default class ContactImportView extends Vue {
|
||||
* Initializes component settings from active account
|
||||
*/
|
||||
private async initializeSettings() {
|
||||
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
if (USE_DEXIE_DB) {
|
||||
settings = await retrieveSettingsForActiveAccount();
|
||||
}
|
||||
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
}
|
||||
@@ -486,13 +478,9 @@ export default class ContactImportView extends Vue {
|
||||
const dbAllContacts = await platformService.dbQuery(
|
||||
"SELECT * FROM contacts",
|
||||
);
|
||||
let baseContacts = databaseUtil.mapQueryResultToValues(
|
||||
const baseContacts = databaseUtil.mapQueryResultToValues(
|
||||
dbAllContacts,
|
||||
) as unknown as Contact[];
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
baseContacts = await db.contacts.toArray();
|
||||
}
|
||||
|
||||
// Check for existing contacts and differences
|
||||
for (let i = 0; i < this.contactsImporting.length; i++) {
|
||||
@@ -618,13 +606,7 @@ export default class ContactImportView extends Vue {
|
||||
[contact.did],
|
||||
);
|
||||
await platformService.dbExec(sql, params);
|
||||
if (USE_DEXIE_DB) {
|
||||
// For Dexie, we need to parse the contactMethods back to an array
|
||||
await db.contacts.update(
|
||||
contact.did,
|
||||
dbRecordToContact(contactToStore),
|
||||
);
|
||||
}
|
||||
|
||||
updatedCount++;
|
||||
} else {
|
||||
// Add new contact
|
||||
@@ -633,10 +615,7 @@ export default class ContactImportView extends Vue {
|
||||
"contacts",
|
||||
);
|
||||
await platformService.dbExec(sql, params);
|
||||
if (USE_DEXIE_DB) {
|
||||
// For Dexie, we need to parse the contactMethods back to an array
|
||||
await db.contacts.add(dbRecordToContact(contactToStore));
|
||||
}
|
||||
|
||||
importedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user