Browse Source

IndexedDB migration: ensure output is printed during comparison (no logic changes)

Trent Larson 2 weeks ago
parent
commit
a248e9a5a3
  1. 27
      src/services/indexedDBMigrationService.ts

27
src/services/indexedDBMigrationService.ts

@ -182,11 +182,9 @@ export async function getSqliteContacts(): Promise<Contact[]> {
const platformService = PlatformServiceFactory.getInstance(); const platformService = PlatformServiceFactory.getInstance();
const result = await platformService.dbQuery("SELECT * FROM contacts"); const result = await platformService.dbQuery("SELECT * FROM contacts");
if (!result?.values?.length) { let contacts: Contact[] = [];
return []; if (result?.values?.length) {
} contacts = result.values.map((row) => {
const contacts = result.values.map((row) => {
const contact = parseJsonField(row, {}) as Contact; const contact = parseJsonField(row, {}) as Contact;
return { return {
did: contact.did || "", did: contact.did || "",
@ -203,6 +201,7 @@ export async function getSqliteContacts(): Promise<Contact[]> {
registered: contact.registered || false, registered: contact.registered || false,
} as Contact; } as Contact;
}); });
}
logger.info( logger.info(
`[MigrationService] Retrieved ${contacts.length} contacts from SQLite`, `[MigrationService] Retrieved ${contacts.length} contacts from SQLite`,
@ -280,11 +279,9 @@ export async function getSqliteSettings(): Promise<Settings[]> {
const platformService = PlatformServiceFactory.getInstance(); const platformService = PlatformServiceFactory.getInstance();
const result = await platformService.dbQuery("SELECT * FROM settings"); const result = await platformService.dbQuery("SELECT * FROM settings");
if (!result?.values?.length) { let settings: Settings[] = [];
return []; if (result?.values?.length) {
} settings = result.values.map((row) => {
const settings = result.values.map((row) => {
const setting = parseJsonField(row, {}) as Settings; const setting = parseJsonField(row, {}) as Settings;
return { return {
id: setting.id, id: setting.id,
@ -315,6 +312,7 @@ export async function getSqliteSettings(): Promise<Settings[]> {
vapid: setting.vapid || "", vapid: setting.vapid || "",
} as Settings; } as Settings;
}); });
}
logger.info( logger.info(
`[MigrationService] Retrieved ${settings.length} settings from SQLite`, `[MigrationService] Retrieved ${settings.length} settings from SQLite`,
@ -355,11 +353,9 @@ export async function getSqliteAccounts(): Promise<Account[]> {
const platformService = PlatformServiceFactory.getInstance(); const platformService = PlatformServiceFactory.getInstance();
const result = await platformService.dbQuery("SELECT * FROM accounts"); const result = await platformService.dbQuery("SELECT * FROM accounts");
if (!result?.values?.length) { let accounts: Account[] = [];
return []; if (result?.values?.length) {
} accounts = result.values.map((row) => {
const accounts = result.values.map((row) => {
const account = parseJsonField(row, {}) as Account; const account = parseJsonField(row, {}) as Account;
return { return {
id: account.id, id: account.id,
@ -372,6 +368,7 @@ export async function getSqliteAccounts(): Promise<Account[]> {
publicKeyHex: account.publicKeyHex || "", publicKeyHex: account.publicKeyHex || "",
} as Account; } as Account;
}); });
}
logger.info( logger.info(
`[MigrationService] Retrieved ${accounts.length} accounts from SQLite`, `[MigrationService] Retrieved ${accounts.length} accounts from SQLite`,

Loading…
Cancel
Save