78c8d4256c
- Moved all documentation to docs/ and updated README with categorized links and new docs/INDEX.md - Added HOW_TO_SWITCH_DATABASE.md and several new analysis/action docs - Introduced db-config.ps1 for centralized DB config; all scripts now use it for easy DB switching - Added db-quick.ps1 for interactive diagnostics and index management - Updated Add-All-Indexes.bat to use db-config.ps1 - Added Fix-ItemValues-Performance.ps1 to create 3 critical indexes on ItemValues, addressing 1.3B row seq scan issue - Updated performance_indexes.sql with new ItemValues indexes and ANALYZE - Updated diagnostics.sql and database_report.txt for improved output and clarity - All scripts and docs now reference the new config and index optimization workflow
10 KiB
10 KiB
Pull Request: PostgreSQL Integration, Windows Installer, and Documentation Overhaul
🎯 Overview
This PR completes the PostgreSQL integration for Jellyfin with comprehensive Windows installer support, centralized build output, OS-specific configuration, and a complete documentation overhaul.
🚀 What's New
1. Complete Documentation Overhaul 📚
- Rewrote README.md to highlight PostgreSQL features, Windows installer, and migration guides
- Moved all markdown files to
docs/folder for better organization (30+ files organized) - Created comprehensive documentation index with quick start and detailed guides
- Added
README_GENERATION.mdandDOCUMENTATION_ORGANIZATION.mdfor maintenance - Preserved original README as
README.original.md - Clear platform-specific instructions (Windows/Linux/macOS)
2. Professional Windows Installer 💿
- Inno Setup script (
jellyfin-setup.iss) with full wizard support - PowerShell build automation (
build-installer.ps1) for easy installer creation - Features:
- Windows Service installation
- Firewall rules configuration
- PostgreSQL connection wizard
- .NET runtime verification
- Clean uninstaller
- Comprehensive documentation:
INSTALLER_QUICK_START.md- 5-minute guideINSTALLER_GUIDE.md- Complete reference with WiX, MSIX optionsBUILD_INSTALLER_FIXED.md- Build script usage
3. Centralized Build Output 🔨
- All DLLs now output to
lib\[Configuration]\[TargetFramework]\at repository root - Configured via
Directory.Build.props - Benefits:
- Single location for all build artifacts
- Easier deployment and packaging
- No duplicate dependencies
- Faster builds
- Documentation:
CENTRALIZED_LIB_FOLDER.md
4. OS-Specific Startup Configuration ⚙️
- Auto-generates
startup.jsonwith OS-appropriate defaults on first run - Platform defaults:
- Windows:
C:/ProgramData/jellyfin - Linux:
/var/lib/jellyfin,/etc/jellyfin - macOS:
~/Library/Application Support/jellyfin
- Windows:
- Removes null/example config - immediately usable
- Configuration priority: CLI args → Environment vars → startup.json → Built-in defaults
- Documentation:
OS_SPECIFIC_STARTUP_CONFIG.mdSTARTUP_JSON_VERIFICATION.mdSTARTUP_JSON_FIX.md
5. PostgreSQL Migration Improvements 🗄️
- Assign all tables to correct PostgreSQL schemas in EF Core migrations
- Fix identifier quoting (SQL Server brackets → PostgreSQL double quotes)
- Use InsertData for placeholder BaseItems row (no raw SQL)
- Auto-recovery: Handles 42P07 errors (table exists)
- Added
RecordMigrationAsAppliedAsyncfor manual migration history - Improved migration logging and error handling
- Documentation:
POSTGRESQL_MIGRATION_COMPLETE.mdMIGRATION_RECOVERY_FIX.mdSQLITE_MIGRATION_FILTERING_FIX.md
- Idempotent, production-ready SQL migration scripts
- PowerShell script for automated migration verification
6. Platform Configuration Templates 📋
- Added Linux/Windows startup config templates in
Resources/Configuration/ - FHS-compliant default paths
- Platform-specific README with usage instructions
- Improved portability and cross-platform consistency
7. Build and Deployment Improvements 🚢
- Enhanced publish profiles with platform targeting
- Clean deploy: deletes existing files before publish
- Updated
.gitignore:- Excludes
lib/(build output) - Excludes
installer-output/ - Excludes all
PublishProfiles/folders (machine-specific) - Cleaned up tracked publish profile XMLs
- Excludes
- Switched to relative paths for improved portability
📊 Changes Summary
Files Added/Created
build-installer.ps1- PowerShell installer build scriptjellyfin-setup.iss- Inno Setup installer scriptjellyfin.ico- Application icondocs/INSTALLER_QUICK_START.md- 5-minute installer guidedocs/INSTALLER_GUIDE.md- Complete installer documentationdocs/BUILD_INSTALLER_FIXED.md- Build script usagedocs/CENTRALIZED_LIB_FOLDER.md- Build output documentationdocs/OS_SPECIFIC_STARTUP_CONFIG.md- OS configuration guidedocs/STARTUP_JSON_VERIFICATION.md- Configuration loading detailsdocs/STARTUP_JSON_FIX.md- Fixing null value issuesdocs/GITIGNORE_PUBLISHPROFILES.md- GitIgnore documentationdocs/DOCUMENTATION_ORGANIZATION.md- Doc organization summarydocs/README_GENERATION.md- README generation processJellyfin.Server/Resources/Configuration/startup.*.json- Platform templates
Files Modified
README.md- Complete rewrite with PostgreSQL focusDirectory.Build.props- Centralized build output configuration.gitignore- Updated exclusions for lib, installer-output, PublishProfilesJellyfin.Server/Helpers/StartupHelpers.cs- OS-specific config generation- EF Core migrations - PostgreSQL schema and quoting fixes
- Publish profiles - Platform targeting and clean deploy
Files Moved
- 30+ documentation files →
docs/folder - All README links updated to point to
docs/
Files Removed
- Old
Jellyfin.Server/startup.json(now generated at runtime) - Obsolete Windows publish profiles
- Tracked PublishProfiles XML files
🎯 Migration Guide
From SQLite to PostgreSQL
# 1. Backup SQLite database
cp jellyfin.db jellyfin-backup.db
# 2. Install PostgreSQL 12+
winget install PostgreSQL.PostgreSQL
# 3. Create database
psql -U postgres
CREATE USER jellyfin WITH PASSWORD 'your_password';
CREATE DATABASE jellyfin OWNER jellyfin;
\q
# 4. Update startup.json
{
"DatabaseProvider": "Postgres",
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=jellyfin;Username=jellyfin;Password=your_password"
}
}
# 5. Run migration
dotnet run --project Jellyfin.Server -- --migrate-database
See docs/POSTGRESQL_MIGRATION_COMPLETE.md for details.
🔨 Building and Installation
Quick Build
git clone https://gitea.wpjones.com/wjones/pgsql-jellyfin.git
cd pgsql-jellyfin
dotnet build --configuration Release
cd lib/Release/net11.0
dotnet jellyfin.dll
Create Windows Installer
# Install Inno Setup
winget install JRSoftware.InnoSetup
# Build installer
.\build-installer.ps1
# Result: installer-output\JellyfinSetup-PostgreSQL-11.0.0.exe
🧪 Testing
Tested Scenarios
- ✅ Fresh install on Windows
- ✅ Migration from SQLite to PostgreSQL
- ✅ OS-specific configuration generation
- ✅ Windows Service installation
- ✅ Firewall rules creation
- ✅ Build output to lib folder
- ✅ Documentation links and navigation
Tested Platforms
- ✅ Windows 10/11
- ✅ Linux (Ubuntu 22.04)
- ✅ PostgreSQL 12, 14, 15, 16, 17, 18
📝 Documentation
All documentation is now in the docs/ folder with a complete index in README.md:
Configuration
- OS_SPECIFIC_STARTUP_CONFIG.md
- STARTUP_JSON_VERIFICATION.md
- STARTUP_JSON_FIX.md
PostgreSQL
- QUICKSTART_POSTGRESQL.md
- POSTGRESQL_MIGRATION_COMPLETE.md
- POSTGRESQL_TROUBLESHOOTING.md
Installation
- INSTALLER_QUICK_START.md
- INSTALLER_GUIDE.md
- CENTRALIZED_LIB_FOLDER.md
- BUILD_INSTALLER_FIXED.md
Backup & Recovery
- POSTGRES_BACKUP_IMPLEMENTATION.md
- POSTGRESQL_BACKUP_ANALYSIS.md
Project Status
- PROJECT_COMPLETION.md
- POC_SUMMARY_REPORT.md
⚠️ Breaking Changes
None! All changes are backward compatible:
- Existing
startup.jsonfiles are preserved - SQLite users can continue using SQLite
- Migration to PostgreSQL is optional
- Default behavior unchanged for existing installations
🎉 Benefits
For Users
- ✅ Professional Windows installer with wizard
- ✅ Automatic OS-specific configuration
- ✅ Better performance with large media libraries
- ✅ Enterprise-grade database backend
- ✅ Easy migration from SQLite
For Developers
- ✅ Centralized build output (lib folder)
- ✅ Comprehensive documentation
- ✅ Easy installer creation (5 minutes)
- ✅ Clean repository structure
- ✅ Better cross-platform support
For System Admins
- ✅ FHS-compliant paths on Linux
- ✅ Windows Service support
- ✅ Professional backup solutions
- ✅ Database replication and clustering support
🔄 Commits Included
- Docs: overhaul README, centralize docs, update .gitignore - Documentation reorganization
- Add Windows installer scripts, docs, and startup.json fixes - Installer infrastructure
- Centralize build output and generate OS-specific startup.json - Build improvements
- Platform config templates & Postgres migration recovery - Configuration and migration
- PostgreSQL migration: schema fixes, docs, and tooling - Database migrations
- Update publish profiles and .gitignore for Windows build - Build configuration
- Update publish profile and web dir config for portability - Path improvements
📞 Support
✅ Checklist
- Code compiles without errors
- All tests pass
- Documentation updated and comprehensive
- README.md reflects all changes
- .gitignore updated appropriately
- Migration scripts tested
- Windows installer tested
- Cross-platform compatibility verified
- No breaking changes introduced
🎯 Ready to Merge
This PR represents a major milestone for the PostgreSQL-enabled Jellyfin fork:
- Complete documentation overhaul with 30+ organized files
- Professional Windows installer with service support
- Centralized build output for easier deployment
- OS-specific configuration that "just works"
- Robust PostgreSQL migration with auto-recovery
- Production-ready, tested, and documented
Recommended for merge into main branch.
Pull Request Type: Feature + Documentation + Build Improvement
Target Branch: main
Source Branch: pgsql_testing_branch
Reviewer: @maintainers
Priority: High