You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.1 KiB
3.1 KiB
Database Clearing for Development
Author: Matthew Raymer
Date: 2025-07-11
Status: ACTIVE - Production Ready
Overview
TimeSafari provides a simple script-based approach to clear the database for development purposes. This avoids the complexity of programmatic database clearing and provides reliable, platform-specific solutions.
Quick Start
# Run the interactive database clearing script
./scripts/clear-database.sh
# Then restart your development server
npm run build:electron:dev # For Electron
npm run build:web:dev # For Web
Platform-Specific Approaches
Electron (Desktop App)
The script automatically detects your platform and clears the SQLite database files:
- Linux:
~/.config/TimeSafari/
- macOS:
~/Library/Application Support/TimeSafari/
- Windows:
%APPDATA%\TimeSafari
Web Browser
For web browsers, the script provides two approaches:
1. Custom Data Directory (Recommended)
Create an isolated browser profile for development:
# Create isolated profile
mkdir ~/timesafari-dev-data
# Start browser with custom profile
google-chrome --user-data-dir=~/timesafari-dev-data
# Clear when needed
rm -rf ~/timesafari-dev-data
2. Manual Browser Clearing
Use browser DevTools to clear IndexedDB:
- Open Developer Tools (F12)
- Go to Application/Storage tab
- Find 'IndexedDB' section
- Delete 'TimeSafari' database
- Refresh the page
Why Script-Based Approach?
Simplicity
- No complex programmatic database clearing
- No browser storage complications
- No race conditions or permission issues
Reliability
- Direct file system access for Electron
- Isolated browser profiles for web
- Clear, predictable behavior
Safety
- Interactive script guides users
- Platform-specific instructions
- Only clears TimeSafari data
Manual Commands
If you prefer manual commands:
Electron
# Linux
rm -rf ~/.config/TimeSafari/*
# macOS
rm -rf ~/Library/Application\ Support/TimeSafari/*
# Windows
rmdir /s /q %APPDATA%\TimeSafari
Web Browser
# Create and use isolated profile
mkdir ~/timesafari-dev-data
google-chrome --user-data-dir=~/timesafari-dev-data
# Clear when needed
rm -rf ~/timesafari-dev-data
Best Practices
- Stop the development server before clearing
- Use isolated browser profiles for web development
- Restart the development server after clearing
- Backup important data before clearing
- Use the script for consistent behavior
Troubleshooting
Script Not Found
# Make sure script is executable
chmod +x scripts/clear-database.sh
# Run from project root
./scripts/clear-database.sh
Permission Errors
# Check file permissions
ls -la ~/.config/TimeSafari/
# Use sudo if needed (rare)
sudo rm -rf ~/.config/TimeSafari/*
Browser Profile Issues
# Ensure browser is completely closed
pkill -f chrome
pkill -f firefox
# Then clear profile
rm -rf ~/timesafari-dev-data
Last Updated: 2025-07-11
Version: 1.0.3-beta
Status: Production Ready