gcp-hockey-results/motm_app/POSTGRESQL_SETUP.md

61 lines
1.5 KiB
Markdown

# PostgreSQL Database Setup
This application is now configured to use PostgreSQL as the default database instead of SQLite.
## Database Configuration
The application connects to a PostgreSQL database with the following settings:
- **Host**: icarus.ipa.champion
- **Port**: 5432
- **Database**: motm
- **Username**: motm_user
- **Password**: q7y7f7Lv*sODJZ2wGiv0Wq5a
## Running the Application
### Linux/macOS
```bash
./run_motm.sh
```
### Windows
```cmd
run_motm.bat
```
### Manual Setup
If you need to run the application manually, set these environment variables:
```bash
export DATABASE_TYPE=postgresql
export POSTGRES_HOST=icarus.ipa.champion
export POSTGRES_PORT=5432
export POSTGRES_DATABASE=motm
export POSTGRES_USER=motm_user
export POSTGRES_PASSWORD='q7y7f7Lv*sODJZ2wGiv0Wq5a'
```
## Database Status
The PostgreSQL database contains the following data:
- **Players**: 3 players in the `_hkfc_players` table
- **Match Squad**: 3 players currently selected for the match squad
- **Admin Settings**: Configured with next match details
## Troubleshooting
If you encounter issues:
1. **Connection Failed**: Check if the PostgreSQL server is accessible
2. **Empty Data**: The database contains sample data - if you see empty tables, check the connection
3. **Permission Errors**: Ensure the `motm_user` has proper database permissions
## Testing Database Connection
Run the test script to verify everything is working:
```bash
python3 test_match_squad.py
```
This will test the database connection and display current data.