diff --git a/BUILDING.md b/BUILDING.md index a159d900..0ab17341 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -66,7 +66,7 @@ Install dependencies: * Put the commit hash in the changelog (which will help you remember to bump the version later). -* Tag with the new version, [online](https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/releases) or `git tag 0.3.55 && git push origin 0.3.55`. +* Tag with the new version, [online](https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/releases) or `git tag 0.5.8 && git push origin 0.5.8`. * For test, build the app (because test server is not yet set up to build): @@ -90,9 +90,9 @@ TIME_SAFARI_APP_TITLE="TimeSafari_Test" VITE_APP_SERVER=https://test.timesafari. * `pkgx +npm sh` - * `cd crowd-funder-for-time-pwa && git checkout master && git pull && git checkout 0.3.55 && npm install && npm run build && cd -` + * `cd crowd-funder-for-time-pwa && git checkout master && git pull && git checkout 0.5.8 && npm install && npm run build:web && cd -` - (The plain `npm run build` uses the .env.production file.) + (The plain `npm run build:web` uses the .env.production file.) * Back up the time-safari/dist folder & deploy: `mv time-safari/dist time-safari-dist-prev.0 && mv crowd-funder-for-time-pwa/dist time-safari/` diff --git a/src/constants/app.ts b/src/constants/app.ts index b8dadbd4..a08cb15a 100644 --- a/src/constants/app.ts +++ b/src/constants/app.ts @@ -51,7 +51,7 @@ export const IMAGE_TYPE_PROFILE = "profile"; export const PASSKEYS_ENABLED = !!import.meta.env.VITE_PASSKEYS_ENABLED || false; -export const USE_DEXIE_DB = true; +export const USE_DEXIE_DB = false; /** * The possible values for "group" and "type" are in App.vue. diff --git a/src/services/migrationService.ts b/src/services/migrationService.ts index 234629af..45fcdb95 100644 --- a/src/services/migrationService.ts +++ b/src/services/migrationService.ts @@ -28,7 +28,6 @@ import { Settings, MASTER_SETTINGS_KEY } from "../db/tables/settings"; import { Account } from "../db/tables/accounts"; import { logger } from "../utils/logger"; import { parseJsonField } from "../db/databaseUtil"; -import { USE_DEXIE_DB } from "../constants/app"; import { importFromMnemonic } from "../libs/util"; /** @@ -133,10 +132,6 @@ export interface MigrationResult { * ``` */ export async function getDexieContacts(): Promise { - if (!USE_DEXIE_DB) { - throw new Error("Dexie database is not enabled"); - } - try { await db.open(); const contacts = await db.contacts.toArray(); @@ -215,8 +210,8 @@ export async function getSqliteContacts(): Promise { * Retrieves all settings from the Dexie (IndexedDB) database * * This function connects to the Dexie database and retrieves all settings - * records. It requires that USE_DEXIE_DB is enabled in the app constants. - * + * records. + * * Settings include both master settings (id=1) and account-specific settings * that override the master settings for particular user accounts. * @@ -235,10 +230,6 @@ export async function getSqliteContacts(): Promise { * ``` */ export async function getDexieSettings(): Promise { - if (!USE_DEXIE_DB) { - throw new Error("Dexie database is not enabled"); - } - try { await db.open(); const settings = await db.settings.toArray(); @@ -388,7 +379,7 @@ export async function getSqliteAccounts(): Promise { * Retrieves all accounts from the Dexie (IndexedDB) database * * This function connects to the Dexie database and retrieves all account - * records. It requires that USE_DEXIE_DB is enabled in the app constants. + * records. * * The function handles database opening and error conditions, providing * detailed logging for debugging purposes. @@ -408,10 +399,6 @@ export async function getSqliteAccounts(): Promise { * ``` */ export async function getDexieAccounts(): Promise { - if (!USE_DEXIE_DB) { - throw new Error("Dexie database is not enabled"); - } - try { const accountsDB = await accountsDBPromise; await accountsDB.open(); @@ -1799,60 +1786,3 @@ export async function migrateAll( return result; } } - -/** - * Test function to verify migration of specific settings fields - * - * This function tests the migration of the specific fields you mentioned: - * firstName, isRegistered, profileImageUrl, showShortcutBvc, and searchBoxes - * - * @returns Promise - */ -export async function testSettingsMigration(): Promise { - logger.info("[MigrationService] Starting settings migration test"); - - try { - // First, compare databases to see current state - const comparison = await compareDatabases(); - logger.info("[MigrationService] Pre-migration comparison:", { - dexieSettings: comparison.dexieSettings.length, - sqliteSettings: comparison.sqliteSettings.length, - dexieAccounts: comparison.dexieAccounts.length, - sqliteAccounts: comparison.sqliteAccounts.length - }); - - // Run settings migration - const settingsResult = await migrateSettings(true); - logger.info("[MigrationService] Settings migration result:", settingsResult); - - // Run accounts migration - const accountsResult = await migrateAccounts(true); - logger.info("[MigrationService] Accounts migration result:", accountsResult); - - // Compare databases again to see changes - const postComparison = await compareDatabases(); - logger.info("[MigrationService] Post-migration comparison:", { - dexieSettings: postComparison.dexieSettings.length, - sqliteSettings: postComparison.sqliteSettings.length, - dexieAccounts: postComparison.dexieAccounts.length, - sqliteAccounts: postComparison.sqliteAccounts.length - }); - - // Check if the specific fields were migrated - if (postComparison.sqliteSettings.length > 0) { - const sqliteSettings = postComparison.sqliteSettings[0]; - logger.info("[MigrationService] Migrated settings fields:", { - firstName: sqliteSettings.firstName, - isRegistered: sqliteSettings.isRegistered, - profileImageUrl: sqliteSettings.profileImageUrl, - showShortcutBvc: sqliteSettings.showShortcutBvc, - searchBoxes: sqliteSettings.searchBoxes - }); - } - - logger.info("[MigrationService] Migration test completed successfully"); - } catch (error) { - logger.error("[MigrationService] Migration test failed:", error); - throw error; - } -} diff --git a/src/views/DatabaseMigration.vue b/src/views/DatabaseMigration.vue index 2335884d..580497e4 100644 --- a/src/views/DatabaseMigration.vue +++ b/src/views/DatabaseMigration.vue @@ -2,7 +2,7 @@
-
+

Database Migration

Compare and migrate data between Dexie (IndexedDB) and SQLite @@ -10,33 +10,34 @@

- -
-
-
- -
-
-

- Dexie Database Disabled +
+ +
+
+

+ Migration Options

-
-

- To use migration features, enable Dexie database by setting - - USE_DEXIE_DB = true - - in - - constants/app.ts - + +

+
+ + +
+ +

+ When enabled, existing records in SQLite will be updated with + data from Dexie. When disabled, existing records will be skipped + during migration.

@@ -44,9 +45,28 @@
-
+
+ + - - - -
@@ -760,45 +762,27 @@
- - -
-
-

- Migration Options -

- -
-
- - -
- -

- When enabled, existing records in SQLite will be updated with - data from Dexie. When disabled, existing records will be skipped - during migration. -

-
-
-

+ + +
+

Exported Data

+ + Copy to Clipboard + +
{{ JSON.stringify(exportedData, null, 2) }}
+