feat: Add database migration tools and fix Electron integration

- Add comprehensive IndexedDB to SQLite migration service (1,397 lines)
- Create migration UI with progress tracking and validation (1,492 lines)
- Fix Electron TypeScript compilation and SQLite plugin issues
- Expand migration system with detailed documentation and error handling
- Add development guide and coding standards

Resolves: #electron-startup #database-migration #typescript-errors
Impact: Enables user-friendly database migration with full data verification
This commit is contained in:
Matthew Raymer
2025-07-01 03:47:32 +00:00
parent dfa2168d9e
commit a4c44ff052
10 changed files with 3295 additions and 157 deletions

View File

@@ -175,17 +175,17 @@ export let memoryLogs: string[] = [];
* @author Matthew Raymer
*/
export async function logToDb(message: string): Promise<void> {
const platform = PlatformServiceFactory.getInstance();
const todayKey = new Date().toDateString();
const nowKey = new Date().toISOString();
try {
memoryLogs.push(`${new Date().toISOString()} ${message}`);
// TEMPORARILY DISABLED: Database logging to break error loop
// TODO: Fix schema mismatch - logs table uses 'timestamp' not 'date'
// await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
// nowKey,
// message,
// ]);
// Try to insert first, if it fails due to UNIQUE constraint, update instead
await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
nowKey,
message,
]);
// Clean up old logs (keep only last 7 days) - do this less frequently
// Only clean up if the date is different from the last cleanup
@@ -196,11 +196,9 @@ export async function logToDb(message: string): Promise<void> {
memoryLogs = memoryLogs.filter(
(log) => log.split(" ")[0] > sevenDaysAgo.toDateString(),
);
// TEMPORARILY DISABLED: Database cleanup
// await platform.dbExec("DELETE FROM logs WHERE date < ?", [
// sevenDaysAgo.toDateString(),
// ]);
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
sevenDaysAgo.toDateString(),
]);
lastCleanupDate = todayKey;
}
} catch (error) {