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:
Matthew Raymer
2025-06-23 08:25:10 +00:00
parent 419243b5cd
commit ebc241eba0
70 changed files with 185 additions and 3986 deletions

View File

@@ -318,14 +318,8 @@ import {
AppString,
NotificationIface,
PASSKEYS_ENABLED,
USE_DEXIE_DB,
} from "../constants/app";
import {
db,
logConsoleAndDb,
retrieveSettingsForActiveAccount,
updateAccountSettings,
} from "../db/index";
import { logConsoleAndDb } from "../db/index";
import { Contact } from "../db/tables/contacts";
import {
BoundingBox,
@@ -552,9 +546,6 @@ export default class HomeView extends Vue {
let settings;
try {
settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (USE_DEXIE_DB) {
settings = await retrieveSettingsForActiveAccount();
}
} catch (error) {
logConsoleAndDb(
`[HomeView] Failed to retrieve settings: ${error}`,
@@ -623,12 +614,6 @@ export default class HomeView extends Vue {
isRegistered: true,
...(await databaseUtil.retrieveSettingsForActiveAccount()),
});
if (USE_DEXIE_DB) {
await updateAccountSettings(this.activeDid, {
isRegistered: true,
...(await retrieveSettingsForActiveAccount()),
});
}
this.isRegistered = true;
}
} catch (error) {
@@ -707,10 +692,7 @@ export default class HomeView extends Vue {
* Called by mounted() and reloadFeedOnChange()
*/
private async loadSettings() {
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (USE_DEXIE_DB) {
settings = await retrieveSettingsForActiveAccount();
}
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
this.apiServer = settings.apiServer || "";
this.activeDid = settings.activeDid || "";
this.feedLastViewedClaimId = settings.lastViewedClaimId;
@@ -739,9 +721,6 @@ export default class HomeView extends Vue {
this.allContacts = databaseUtil.mapQueryResultToValues(
dbContacts,
) as unknown as Contact[];
if (USE_DEXIE_DB) {
this.allContacts = await db.contacts.toArray();
}
this.blockedContactDids = this.allContacts
.filter((c) => !c.iViewContent)
.map((c) => c.did);
@@ -765,22 +744,13 @@ export default class HomeView extends Vue {
this.activeDid,
);
if (resp.status === 200) {
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (USE_DEXIE_DB) {
settings = await retrieveSettingsForActiveAccount();
}
const settings =
await databaseUtil.retrieveSettingsForActiveAccount();
await databaseUtil.updateDidSpecificSettings(this.activeDid, {
apiServer: this.apiServer,
isRegistered: true,
...settings,
});
if (USE_DEXIE_DB) {
await updateAccountSettings(this.activeDid, {
apiServer: this.apiServer,
isRegistered: true,
...settings,
});
}
this.isRegistered = true;
}
} catch (e) {
@@ -841,10 +811,7 @@ export default class HomeView extends Vue {
* Called by mounted()
*/
private async checkOnboarding() {
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (USE_DEXIE_DB) {
settings = await retrieveSettingsForActiveAccount();
}
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (!settings.finishedOnboarding) {
(this.$refs.onboardingDialog as OnboardingDialog).open(OnboardPage.Home);
}
@@ -913,10 +880,7 @@ export default class HomeView extends Vue {
* Called by FeedFilters component when filters change
*/
async reloadFeedOnChange() {
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
if (USE_DEXIE_DB) {
settings = await retrieveSettingsForActiveAccount();
}
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
this.isFeedFilteredByVisible = !!settings.filterFeedByVisible;
this.isFeedFilteredByNearby = !!settings.filterFeedByNearby;
this.isAnyFeedFilterOn = checkIsAnyFeedFilterOn(settings);
@@ -1364,12 +1328,6 @@ export default class HomeView extends Vue {
await databaseUtil.updateDefaultSettings({
lastViewedClaimId: records[0].jwtId,
});
if (USE_DEXIE_DB) {
await db.open();
await db.settings.update(MASTER_SETTINGS_KEY, {
lastViewedClaimId: records[0].jwtId,
});
}
}
}