feat: Migrate data storage to PostgreSQL with schema setup, initialization script, and update documentation

This commit is contained in:
ethan.chen
2026-01-08 11:14:35 +08:00
parent 62a9d01035
commit ca6fa71f38
16 changed files with 718 additions and 238 deletions

View File

@@ -176,13 +176,35 @@ Example configuration for Claude Desktop (`claude_desktop_config.json`):
## Data Storage
All data is stored locally in JSON files in the `data/` directory:
- `codeSnippets.json` - Code snippets
- `notes.json` - Personal notes
- `tasks.json` - Tasks
- `babyMilestones.json` - Baby milestones
- `mathResources.json` - Math resources
- `gameWishlist.json` - Game wishlist
All data is stored in PostgreSQL database. The application requires a PostgreSQL database connection.
### Database Setup
1. **Configure Database Connection**
Set the `DATABASE_URL` environment variable in your `.env` file:
```
DATABASE_URL=postgresql://user:password@host:port/database
```
2. **Initialize Database Schema**
Run the initialization script to create all required tables:
```bash
bun run init-db
```
This will create the following tables:
- `code_snippets` - Code snippets
- `notes` - Personal notes
- `tasks` - Tasks
- `baby_milestones` - Baby milestones
- `math_resources` - Math resources
- `game_wishlist` - Game wishlist
### Database Schema
The database schema is defined in `src/storage/schema.sql`. All tables include appropriate indexes for optimal query performance.
## Development