86211923db
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
3.0 KiB
3.0 KiB
pgAdmin Database Administration Guide
Access pgAdmin
- URL: http://localhost:8080
- Email: admin@serpentrace.dev
- Password: admin
Pre-configured Server
The pgAdmin interface should have a pre-configured server named "SerpentRace PostgreSQL Dev" in the "Development" group.
Manual Server Configuration (If Needed)
If the server is not automatically configured, add it manually:
Server Details
- Name: SerpentRace PostgreSQL Dev
- Host: postgres (or localhost if connecting from outside Docker)
- Port: 5432
- Database: serpentrace
- Username: postgres
- Password: postgres
Steps to Add Server Manually
- Right-click on "Servers" in the left panel
- Select "Register" > "Server..."
- Fill in the "General" tab:
- Name:
SerpentRace PostgreSQL Dev - Server group:
Development
- Name:
- Fill in the "Connection" tab:
- Host name/address:
postgres - Port:
5432 - Maintenance database:
serpentrace - Username:
postgres - Password:
postgres
- Host name/address:
- Click "Save"
Common Database Operations
View Tables
- Expand the server connection
- Expand "Databases" > "serpentrace"
- Expand "Schemas" > "public"
- Expand "Tables"
Run SQL Queries
- Right-click on the database name
- Select "Query Tool"
- Write your SQL queries in the editor
- Click the "Execute" button or press F5
View Data
- Right-click on any table
- Select "View/Edit Data" > "All Rows"
Troubleshooting
Connection Issues
- Ensure Docker containers are running:
docker ps - Check container logs:
docker logs serpentrace-postgres-dev - Test connections:
npm run test:connections
Authentication Failed
- Verify the password is correct:
postgres - Check if you're using the correct hostname:
postgres(inside Docker) vslocalhost(outside Docker)
Server Not Appearing
- Restart pgAdmin container:
docker-compose -f docker-compose.dev.yml restart pgadmin - Clear browser cache and reload
Development Tips
Useful SQL Queries
-- List all tables
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'public';
-- Check database size
SELECT pg_size_pretty(pg_database_size('serpentrace'));
-- View active connections
SELECT * FROM pg_stat_activity WHERE datname = 'serpentrace';
-- Check migration status (if using TypeORM)
SELECT * FROM migrations ORDER BY timestamp DESC;
Database Backup
- Right-click on database name
- Select "Backup..."
- Choose format (Custom recommended for pgAdmin restore)
- Set filename and location
- Click "Backup"
Database Restore
- Right-click on "Databases"
- Select "Restore..."
- Choose the backup file
- Configure options as needed
- Click "Restore"
Security Notes
⚠️ Development Only: The current configuration uses default credentials and is intended for development only. For production:
- Use strong, unique passwords
- Enable SSL connections
- Restrict network access
- Use environment variables for credentials
- Enable authentication and authorization features