PostgreSQL Backend
Switch from SQLite to PostgreSQL for multi-instance deployments.
Fresh Install
createdb noba
pip install psycopg2-binary
export DATABASE_URL=postgresql://noba:yourpassword@localhost:5432/noba
noba-web
Schema is auto-created on first run.
Migrating from SQLite
DATABASE_URL=postgresql://noba:yourpassword@localhost:5432/noba \
python3 scripts/migrate-to-postgres.py
The migration script automatically stops the running NOBA server for a consistent snapshot.
Schema Management
PostgreSQL uses Alembic for migrations via the noba-migrate CLI:
noba-migrate status # Check current version
noba-migrate upgrade # Apply all pending migrations
noba-migrate history # View full migration history
noba-migrate stamp 001 # Mark existing schema as current
Connection Pooling
Separate read/write connection paths. Reads use a ThreadedConnectionPool with read-only transactions, writes use a dedicated persistent connection. Pool size tunable via NOBA_PG_POOL_MIN/NOBA_PG_POOL_MAX.