Files
family-hub/update_and_init.bat

70 lines
2.1 KiB
Batchfile

@echo off
echo ========================================
echo Family Hub - Download Latest Code
echo ========================================
echo.
cd D:\Hosted\familyhub
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: Cleaning up old files...
if exist backend\init_db.py (
del backend\init_db.py
echo Removed old init_db.py
)
if exist backend\app\models\chore.py (
del backend\app\models\chore.py
echo Removed old chore.py
)
echo.
echo Step 3: Downloading latest files from Gitea...
echo.
echo Downloading init_db.py...
curl -o backend\init_db.py https://gitea.hideawaygaming.com.au/jessikitty/family-hub/raw/branch/main/backend/init_db.py
echo.
echo Downloading updated chore.py model...
mkdir backend\app\models 2>nul
curl -o backend\app\models\chore.py https://gitea.hideawaygaming.com.au/jessikitty/family-hub/raw/branch/main/backend/app/models/chore.py
echo.
echo Step 4: Removing old database...
if exist backend\data\family_hub.db (
del backend\data\family_hub.db
echo Old database removed
)
echo.
echo Step 5: Initializing database with demo data...
venv\Scripts\python.exe backend\init_db.py
echo.
if %ERRORLEVEL% EQU 0 (
echo ========================================
echo SUCCESS! Database initialized
echo ========================================
echo.
echo Next steps:
echo 1. Start backend: venv\Scripts\python.exe -m uvicorn app.main:app --reload
echo 2. In another terminal, start frontend: cd frontend ^&^& npm run dev
echo.
echo Login credentials:
echo Username: jess (admin) or lou, william, xander, bella
echo Password: password123
) else (
echo ========================================
echo ERROR: Database initialization failed
echo ========================================
echo Please check the error messages above
)
pause