diff --git a/deployment/windows/README.md b/deployment/windows/README.md index 9126d93..f331eb1 100644 --- a/deployment/windows/README.md +++ b/deployment/windows/README.md @@ -154,6 +154,56 @@ deploy.sh (Linux) │ --- +## Data Preserved During Deploy + +During deployment, the following are **automatically preserved** (not overwritten): + +### Files Preserved + +| Item | Location | Description | +|------|----------|-------------| +| `.env` | `backend/.env` | Environment configuration | +| `data/` | `backend/data/` | All SQLite databases and uploads | + +### Data Directory Structure + +``` +backend/data/ +├── receipts/ # Data Entry module +│ ├── receipts*.db # SQLite database (bonuri, aprobări, workflow) +│ └── uploads/ # User-uploaded files (PDF/images) +├── telegram/ # Telegram Bot module +│ └── telegram*.db # Bot auth/session data +└── cache/ # Reports module + └── roa2web_cache*.db # L2 cache (can be regenerated) +``` + +### Preservation Mechanism + +The `ROA2WEB-Console.ps1` script: + +1. **Before deploy**: Copies `data/` to `%TEMP%\roa2web-data-backup-*` +2. **During deploy**: Deletes and replaces entire `backend/` folder +3. **After deploy**: Restores `data/` from backup + +**Safe to lose** (regenerated automatically): +- `cache/*.db` - Reports cache, rebuilt on first query + +**Critical data** (must be preserved): +- `receipts/*.db` - User data, approvals, workflow states +- `telegram/*.db` - Bot authentication tokens + +### Manual Backup + +```powershell +# Create manual backup before major operations +Copy-Item -Path "C:\inetpub\wwwroot\roa2web\backend\data" ` + -Destination "C:\backups\roa2web-data-$(Get-Date -Format 'yyyyMMdd')" ` + -Recurse +``` + +--- + ## Troubleshooting | Problemă | Verificare | Soluție | diff --git a/deployment/windows/scripts/ROA2WEB-Console.ps1 b/deployment/windows/scripts/ROA2WEB-Console.ps1 index b931da2..014ddbd 100644 --- a/deployment/windows/scripts/ROA2WEB-Console.ps1 +++ b/deployment/windows/scripts/ROA2WEB-Console.ps1 @@ -817,7 +817,10 @@ function Deploy-Backend { $dataTempPath = Join-Path $env:TEMP "roa2web-data-backup-$(Get-Date -Format 'yyyyMMddHHmmss')" $dataBackup = $null if (Test-Path $dataDir) { - Write-Info "Preserving data directory (SQLite databases, uploads, cache)" + Write-Info "Preserving data directory: receipts.db, telegram.db, cache, uploads" + Write-Info " - receipts/: Data Entry SQLite database (receipts, approvals)" + Write-Info " - telegram/: Telegram bot auth/session database" + Write-Info " - cache/: Reports L2 cache database" Copy-Item -Path $dataDir -Destination $dataTempPath -Recurse -Force $dataBackup = $dataTempPath }