Overview
SS-IMS uses PostgreSQL (v13+) as its primary data store for all tournament data including players, teams, matches, scores, and referee information. The application uses Entity Framework Core with a database-first approach.
PostgreSQL Installation
Linux (Ubuntu/Debian)
Install PostgreSQL
sudo apt update
sudo apt install postgresql postgresql-contrib
Start PostgreSQL service
sudo systemctl start postgresql
sudo systemctl enable postgresql
Verify installation
sudo systemctl status postgresql
macOS
Install using Homebrew
brew install postgresql@15
Start PostgreSQL
brew services start postgresql@15
Windows
Download and run the PostgreSQL installer from the official website. The installer includes pgAdmin 4 for database management.
Docker
docker run --name ss-postgres \
-e POSTGRES_USER=ss \
-e POSTGRES_PASSWORD=ss \
-e POSTGRES_DB=ss26db \
-p 5432:5432 \
-d postgres:15
Database Configuration
Create Database and User
Access PostgreSQL as superuser
Create database user
CREATE USER ss WITH PASSWORD 'your_secure_password' ;
Create database
CREATE DATABASE ss26db OWNER ss;
Grant privileges
GRANT ALL PRIVILEGES ON DATABASE ss26db TO ss;
Schema Application
SS-IMS uses a database-first approach with tables excluded from Entity Framework migrations. The schema must be applied manually.
Download Schema
The official database schema is maintained as a Gist:
Schema URL: https://gist.github.com/Angarn/ddd9cf693aaeeb9407cc46b750fce3e5
Download the schema file
curl -o schema.sql https://gist.githubusercontent.com/Angarn/ddd9cf693aaeeb9407cc46b750fce3e5/raw/
Apply the schema
psql -U ss -d ss26db -f schema.sql
Or if using sudo: sudo -u postgres psql -d ss26db -f schema.sql
Verify tables were created
psql -U ss -d ss26db -c "\dt"
You should see the following tables:
match_rooms
qualifier_rooms
players
users
osu_users
rounds
scores
referees
The application does not automatically create tables. You must apply the schema manually before running the application for the first time.
Database Initialization
Using Adminer
Adminer is recommended for populating initial tournament data such as rounds, map pools, and players.
Install Adminer
Download Adminer (single PHP file): wget https://www.adminer.org/latest.php -O adminer.php
Or use Docker: docker run -p 8080:8080 -d adminer
Access Adminer
Navigate to:
Standalone: http://localhost/adminer.php
Docker: http://localhost:8080
Login to database
System: PostgreSQL
Server: localhost (or your database host)
Username: ss
Password: (your password)
Database: ss26db
Populate initial data
Use the SQL query editor or table interface to insert:
Tournament rounds and their configurations
Map pools for each round (stored as JSON in map_pool column)
Player registrations
Referee accounts
Entity Framework Migrations
SS-IMS explicitly excludes tables from Entity Framework migrations using ExcludeFromMigrations() in the ModelsContext.cs file. Do not use EF migrations for schema management.
The application uses Entity Framework for:
Data access and querying
Object-relational mapping
Change tracking
But not for:
Schema creation
Schema migrations
Table modifications
Connection Verification
Test your database connection:
Command Line
.NET Application
psql -U ss -d ss26db -h localhost -c "SELECT version();"
The application logs database queries to the console when EnableSensitiveDataLogging() is enabled in ModelsContext.cs.
Backup and Maintenance
Automated Backups
Create backup script
#!/bin/bash
BACKUP_DIR = "/var/backups/postgresql"
TIMESTAMP = $( date +%Y%m%d_%H%M%S )
pg_dump -U ss -d ss26db > " $BACKUP_DIR /ss26db_ $TIMESTAMP .sql"
# Keep only last 7 days of backups
find $BACKUP_DIR -name "ss26db_*.sql" -mtime +7 -delete
Schedule with cron
Add daily backup at 2 AM: 0 2 * * * /path/to/backup.sh
Manual Backup
pg_dump -U ss -d ss26db > ss26db_backup.sql
Restore from Backup
psql -U ss -d ss26db < ss26db_backup.sql
For production deployments:
Disable sensitive data logging - Remove EnableSensitiveDataLogging() from ModelsContext.cs
Configure connection pooling - PostgreSQL handles this by default, but tune max_connections in postgresql.conf
Enable query logging - Only for troubleshooting, disable in production
Regular VACUUM - Run VACUUM ANALYZE periodically to maintain performance
Optimize PostgreSQL Configuration
Edit /etc/postgresql/[version]/main/postgresql.conf:
shared_buffers = 256MB # 25% of system RAM
effective_cache_size = 1GB # 50-75% of system RAM
maintenance_work_mem = 64MB
work_mem = 16MB
Restart PostgreSQL after changes:
sudo systemctl restart postgresql
Troubleshooting
Connection Refused
Check PostgreSQL is running
sudo systemctl status postgresql
Verify PostgreSQL is listening
sudo netstat -plnt | grep 5432
Check pg_hba.conf permissions
Edit /etc/postgresql/[version]/main/pg_hba.conf and ensure: host all all 127.0.0.1/32 md5
Authentication Failed
Verify username and password:
psql -U ss -d ss26db -h localhost
If this fails, reset the password:
ALTER USER ss WITH PASSWORD 'new_password' ;
Tables Not Found
Ensure you applied the schema:
psql -U ss -d ss26db -c "\dt"
If no tables appear, re-apply the schema from the Gist.