# Backend Scripts This directory contains database utility scripts for development and testing. ## Environment Variables These scripts require environment variables to be set. Create a `.env` file in the `backend/` directory with the following variables: ```bash # Database Configuration DB_HOST=your-database-host DB_PORT=5432 DB_NAME=your-database-name DB_USER=your-database-user DB_PASSWORD=your-database-password # Legacy API Configuration LEGACY_API_USERNAME=your-username LEGACY_API_TOKEN=your-jwt-token ``` ## Available Scripts ### create-test-user.js Creates a test user with a known OTP code for development/testing. **Usage:** ```bash cd backend node scripts/create-test-user.js ``` This will create a user with: - Email: `test@test.com` - OTP: `123456` ### inspect-db.js Inspects the database schema to understand table structure and columns. **Usage:** ```bash cd backend node scripts/inspect-db.js ``` ### check-legacy-deployments.js Checks synchronization between WellNuo database and Legacy API deployments. **Usage:** ```bash cd backend node check-legacy-deployments.js ``` ### fix-legacy-deployments.js Creates missing legacy deployments for beneficiaries. **Usage:** ```bash cd backend node fix-legacy-deployments.js ``` ## Security ⚠️ **IMPORTANT**: Never commit files containing actual credentials to the repository. Always use environment variables for sensitive information. - Database credentials should be stored in `backend/.env` (this file is git-ignored) - See `backend/.env.example` for the required format