diff --git a/electron/src/rt/sqlite-init.ts b/electron/src/rt/sqlite-init.ts index 6ce1b1d4..eddfe89e 100644 --- a/electron/src/rt/sqlite-init.ts +++ b/electron/src/rt/sqlite-init.ts @@ -99,7 +99,6 @@ interface SQLiteConnectionOptions { version?: number; readOnly?: boolean; readonly?: boolean; - encryption?: string; mode?: string; useNative?: boolean; [key: string]: unknown; @@ -478,12 +477,11 @@ export async function initializeSQLite(): Promise { throw new SQLiteError('Plugin state verification failed', 'initializeSQLite'); } - // Set up database connection + // Set up database connection - simplified to match sacred-sql const connectionOptions = { database: 'timesafari', version: 1, readOnly: false, - encryption: 'no-encryption', useNative: true, mode: 'rwc' }; @@ -508,16 +506,15 @@ export async function initializeSQLite(): Promise { mode: 'rwc' }); - // Set PRAGMAs with detailed logging + // Set PRAGMAs to match sacred-sql approach const pragmaStatements = [ + 'PRAGMA journal_mode = MEMORY;', // Changed to MEMORY mode to match sacred-sql 'PRAGMA foreign_keys = ON;', - 'PRAGMA journal_mode = WAL;', // Changed to WAL for better concurrency 'PRAGMA synchronous = NORMAL;', 'PRAGMA temp_store = MEMORY;', 'PRAGMA page_size = 4096;', - 'PRAGMA cache_size = 2000;', - 'PRAGMA busy_timeout = 15000;', // Increased to 15 seconds - 'PRAGMA wal_autocheckpoint = 1000;' // Added WAL checkpoint setting + 'PRAGMA cache_size = 2000;' + // Removed WAL-specific settings ]; logger.debug('Setting database PRAGMAs'); diff --git a/electron/src/rt/sqlite-migrations.ts b/electron/src/rt/sqlite-migrations.ts index 2a7e68c9..c537c8cd 100644 --- a/electron/src/rt/sqlite-migrations.ts +++ b/electron/src/rt/sqlite-migrations.ts @@ -432,19 +432,9 @@ const MIGRATIONS: Migration[] = [ INITIAL_MIGRATION, { version: 2, - name: '002_secret_and_settings', - description: 'Add secret, settings, contacts, logs, and temp tables with initial data', + name: '002_settings_and_contacts', + description: 'Add settings and contacts tables', sql: ` - -- Secret table for storing encryption keys - -- Note: This is a temporary solution until better secure storage is implemented - CREATE TABLE IF NOT EXISTS secret ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - secretBase64 TEXT NOT NULL - ); - - -- Insert initial secret only if no secret exists - INSERT OR IGNORE INTO secret (id, secretBase64) VALUES (1, '${INITIAL_SECRET}'); - -- Settings table for user preferences and app state CREATE TABLE IF NOT EXISTS settings ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -521,7 +511,6 @@ const MIGRATIONS: Migration[] = [ DROP TABLE IF EXISTS contacts; DROP INDEX IF EXISTS idx_settings_accountDid; DROP TABLE IF EXISTS settings; - DROP TABLE IF EXISTS secret; ` } ];