- Remove connection object and connection pool logic
- Call all database methods directly on window.CapacitorSQLite with db name
- Refactor migrations, queries, and exec to match Capacitor SQLite Electron API
- Ensure preload script exposes both window.electron and window.CapacitorSQLite
- Fixes runtime errors related to missing query/run methods on connection
- Improves security and cross-platform compatibility
Co-authored-by: Matthew Raymer
- Add comprehensive logging for database operations
- Implement proper database path handling and permissions
- Set up WAL journal mode and PRAGMA configurations
- Create initial database schema with tables and triggers
- Add retry logic for database operations
- Implement proper error handling and state management
Current state:
- Database initialization works in main process
- Connection creation succeeds with proper permissions
- Schema creation and table setup complete
- Logging system fully implemented
- Known issue: Property name mismatch between main process and renderer
causing read-only mode conflicts (to be fixed in next commit)
Technical details:
- Uses WAL journal mode for better concurrency
- Implements proper file permissions checking
- Sets up foreign key constraints
- Creates tables: users, time_entries, time_goals, time_goal_entries
- Adds automatic timestamp triggers
- Implements proper connection lifecycle management
Security:
- Proper file permissions (755 for directory)
- No hardcoded credentials
- Proper error handling and logging
- Safe file path handling
Author: Matthew Raymer
- Implement XDG Base Directory Specification for data storage
- Use $XDG_DATA_HOME (defaults to ~/.local/share) for data files
- Add proper directory permissions (700) for security
- Fallback to ~/.timesafari if XDG paths fail
- Add graceful degradation for SQLite failures
- Allow app to boot even if SQLite initialization fails
- Track and expose initialization errors via IPC
- Add availability checks to all SQLite operations
- Improve error reporting and logging
- Security improvements
- Set secure permissions (700) on data directories
- Verify directory permissions on existing paths
- Add proper error handling for permission issues
TODO:
- Fix database creation
- Add retry logic for initialization
- Add reinitialization capability
- Add more detailed error reporting
- Consider fallback storage options