Files
pgsql-jellyfin/scripts/db-config.ps1
wjones 7eb2b445cb Postgres perf, path migration, and shutdown race fixes
- Major query performance boost: replaced correlated subqueries with DistinctBy() in BaseItemRepository, added episode deduplication index, and increased default command timeout to 120s.
- Fixed LibraryMonitor shutdown race: added disposal checks and exception handling in FileRefresher to prevent ObjectDisposedException.
- Added PowerShell and SQL utilities for fixing Linux paths in config files and database; new scripts for WebDir and path migration.
- Auto-fix for WebDir in startup.json on load; new helper scripts and docs.
- Added automated weekly DB performance monitoring scripts and reporting.
- Expanded documentation and README for all fixes, scripts, and migration steps.
- Updated SQL scripts for index creation and diagnostics; improved output handling.
- Updated db-config defaults and added new diagnostic/report files.
2026-03-05 08:56:42 -05:00

58 lines
1.8 KiB
PowerShell

# Database Configuration
# Edit this file to change which database commands run against
# Database connection settings
$PSQL_PATH = "C:\Program Files\PostgreSQL\18\bin\psql.exe"
$DB_USER = "jellyfin"
$DB_NAME = "jellyfin" # ← Change this to switch databases
$DB_HOST = "192.168.129.163"
$DB_PORT = "5432"
# Export for use in other scripts
$global:PSQL_PATH = $PSQL_PATH
$global:DB_USER = $DB_USER
$global:DB_NAME = $DB_NAME
$global:DB_HOST = $DB_HOST
$global:DB_PORT = $DB_PORT
# Helper function to run psql commands
function Invoke-PSQL {
param(
[string]$Query,
[string]$File,
[string]$OutputFile
)
$baseCmd = "& `"$PSQL_PATH`" -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME"
if ($File) {
$cmd = "$baseCmd -f `"$File`""
} elseif ($Query) {
$cmd = "$baseCmd -c `"$Query`""
} else {
Write-Error "Must provide either -Query or -File parameter"
return
}
if ($OutputFile) {
$cmd += " > `"$OutputFile`""
}
Write-Host "Connecting to: $DB_NAME@$DB_HOST as $DB_USER" -ForegroundColor Cyan
Invoke-Expression $cmd
}
# Display current configuration
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Database Configuration Loaded" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Database: $DB_NAME" -ForegroundColor Yellow
Write-Host "User: $DB_USER" -ForegroundColor Yellow
Write-Host "Host: $DB_HOST" -ForegroundColor Yellow
Write-Host "Port: $DB_PORT" -ForegroundColor Yellow
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "To change database, edit: db-config.ps1" -ForegroundColor Gray
Write-Host "Then run: . .\db-config.ps1" -ForegroundColor Gray
Write-Host ""