1.6 KiB
1.6 KiB
Database Fix - READY TO EXECUTE
Problem Found
There were TWO init_db.py files:
D:\Hosted\familyhub\backend\init_db.pyD:\Hosted\familyhub\backend\migrations\init_db.py
Both were using UPPERCASE enum values (DAILY, PENDING, etc.) but the code expects lowercase values (daily, pending, etc.).
What Was Fixed
1. ✅ app/models/chore.py
Added values_callable=lambda x: [e.value for e in x] to all SQLEnum columns to properly match enum values.
2. ✅ app/schemas/chore.py
Fixed due_date validators to convert empty strings to None.
3. ✅ backend/init_db.py
Changed ALL enum values from uppercase to lowercase.
4. ✅ backend/migrations/init_db.py
Changed ALL enum values from uppercase to lowercase.
How To Fix
Option 1: Use the Reset Script (Recommended)
-
Stop the backend server (Ctrl+C)
-
Run the reset script:
cd D:\Hosted\familyhub\backend python reset_database.py -
Restart the backend:
.\start_backend.bat
Option 2: Manual Steps
-
Stop the backend server (Ctrl+C)
-
Delete the database:
del D:\Hosted\familyhub\backend\data\family_hub.db -
Run initialization:
cd D:\Hosted\familyhub\backend python init_db.py -
Restart the backend:
.\start_backend.bat
What You'll Get
After reinitialization:
- 5 demo users (jess, lou, william, xander, bella)
- Password for all:
password123 - 12 demo chores with various frequencies and statuses
- All enum values properly set to lowercase
The chores will now load without errors! 🎉