forked from trent_larson/crowd-funder-for-time-pwa
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user