Files
family-hub/test_local_db.bat

67 lines
1.7 KiB
Batchfile

@echo off
echo ========================================
echo Family Hub - Local Database Test
echo ========================================
echo.
cd /d D:\Hosted\familyhub
echo Activating virtual environment...
call backend\venv\Scripts\activate.bat
echo.
echo Checking for bcrypt...
python -c "import bcrypt" 2>nul
if %ERRORLEVEL% NEQ 0 (
echo bcrypt not found, installing...
pip install bcrypt
echo.
)
echo Step 1: Backing up current database (if exists)...
if exist backend\data\family_hub.db (
copy backend\data\family_hub.db backend\data\family_hub_backup_%date:~-4,4%%date:~-7,2%%date:~-10,2%.db
echo Database backed up successfully
) else (
echo No existing database found
)
echo.
echo Step 2: Removing old database...
if exist backend\data\family_hub.db (
del backend\data\family_hub.db
echo Old database removed
)
echo.
echo Step 3: Initializing database with demo data...
cd backend
python init_db.py
cd ..
echo.
if %ERRORLEVEL% EQU 0 (
echo ========================================
echo SUCCESS! Database initialized
echo ========================================
echo.
echo Your database is ready to use!
echo Location: backend\data\family_hub.db
echo.
echo Login credentials:
echo Username: jess (admin) or lou, william, xander, bella
echo Password: password123
echo.
echo To start the application:
echo Backend: call backend\venv\Scripts\activate ^&^& cd backend ^&^& python -m uvicorn app.main:app --reload
echo Frontend: cd frontend ^&^& npm run dev
) else (
echo ========================================
echo ERROR: Database initialization failed
echo ========================================
echo Please check the error messages above
)
echo.
pause