Commit Graph

96 Commits

Author SHA1 Message Date
wjones caa30d8b88 Remove CREATE DATABASE from schema script - database already created via config 2026-03-08 11:27:30 -04:00
wjones bb9329736f Fix password masking error - password not in args anyway 2026-03-08 11:19:28 -04:00
wjones d4426fe0f6 Use psql subprocess to execute schema script - handles psql meta-commands 2026-03-08 11:13:39 -04:00
wjones 7657caa960 Fix database initialization detection - check for TABLES not just schemas 2026-03-08 11:07:16 -04:00
wjones ac1c2c6c82 CRITICAL FIX: Also disable database migrations in JellyfinMigrationService - was running InitialCreate 2026-03-08 10:50:00 -04:00
wjones 2209f0e1c0 COMPLETE REWRITE: Remove ALL migration code, implement pure SQL script initialization 2026-03-07 13:29:23 -05:00
wjones 7e2c08499b Document automatic empty database initialization feature 2026-03-07 13:08:28 -05:00
wjones 75acefe989 Add automatic SQL script execution for empty database initialization 2026-03-07 13:07:44 -05:00
wjones c4127e7749 Update README paths and disable EnsureCreatedAsync to prevent automatic schema creation 2026-03-07 13:03:10 -05:00
wjones 2d6e10e163 CRITICAL: Also disable EnsureCreatedAsync - it was bypassing migration tracking and creating schema 2026-03-07 13:01:33 -05:00
wjones 5c711bc235 Add database setup documentation for .NET 11 preview manual migration workflow 2026-03-07 12:52:52 -05:00
wjones 091114657b Disable EF Core migrations for .NET 11 preview - use manual SQL scripts instead 2026-03-07 12:52:05 -05:00
wjones 5202d72999 Fix ActivityLogs index creation - remove DO block for CONCURRENTLY support 2026-03-07 12:37:46 -05:00
wjones f47a544c7a Add manual SQL script for applying supplementary indexes migration 2026-03-07 12:35:00 -05:00
wjones f2ddde1747 Remove fallback code for database index creation 2026-03-07 11:52:55 -05:00
wjones e7aa3024cb Refactor BaseItemRepository for ordered DTO materialization
Refactored BaseItemRepository to use a new helper method, MaterializeOrderedDtos, ensuring DTOs are returned in the order of precomputed IDs and improving code reuse. Updated comments to clarify ordering. Cleaned up scenario.json properties and reformatted rebuild-solution.ps1 without changing its logic.
2026-03-07 11:32:56 -05:00
wjones 2ba3335ca0 add .github directory to ignore file 2026-03-07 10:31:09 -05:00
wjones 3c5f94c242 Fix TV shows and movies listing - add default alphabetical ordering 2026-03-07 10:11:07 -05:00
wjones a1c9488c6c Fix library ordering - use ID-based lookup for reliable alphabetical sorting 2026-03-06 18:08:53 -05:00
wjones 26791b568b Fix TV show season ordering - use IndexNumber instead of SortName 2026-03-06 17:52:47 -05:00
wjones 7c032fe4e2 Complete .NET 11.0 upgrade and solution validation
All 41 projects now target .NET 11.0 (PREVIEW). Updated tasks.md to reflect 100% completion of upgrade and validation, including build, test, manual smoke tests, performance checks, and deployment verification. Updated execution-log.md and scenario.json with final validation results and timestamps. Changed Jellyfin.Server.csproj.user to use SelfContained-Win-x64 publish profile. No code changes required for this tier; all tests pass except integration tests pending PostgreSQL infrastructure.
2026-03-06 10:00:45 -05:00
wjones ff89f36120 Complete .NET 11.0 upgrade - all tiers validated 2026-03-06 09:42:36 -05:00
wjones a695189734 Fix EmbeddedImageProviderTests mock setup for async GetMediaAttachmentsAsync 2026-03-06 09:08:44 -05:00
wjones aa57e311ab Fix duplicate dictionary key in PasswordHashTests test data 2026-03-06 08:48:18 -05:00
wjones 3b161b4731 Add .NET 11.0 upgrade plan, assessment, and risk docs
Added a detailed .NET 11.0 (PREVIEW) upgrade plan (plan.md) outlining a bottom-up migration strategy, dependency analysis, risk management, testing, and success criteria for the Jellyfin solution. Introduced assessment.md, assessment.json, and assessment.csv with comprehensive compatibility analysis for all 41 projects, confirming no blocking issues. Added Risk Management Strategies.md detailing mitigation and rollback procedures. Also included scenario.json describing the upgrade scenario and selected strategy. No existing files were changed.
2026-03-05 21:29:18 -05:00
wjones 8b0503f398 Fix EF Core DistinctBy query translation errors
Refactor all item query methods to avoid untranslatable DistinctBy
in IQueryable expressions. Replace ApplyGroupingFilter with a
two-phase pattern: load IDs and grouping keys to memory, apply
grouping and paging in-memory, then reload full entities by ID.
Add ApplyGroupingInMemory<T> and ApplyPagingToIds helpers.
Use AsEnumerable() before DistinctBy in GetItemValues to force
client-side evaluation. Resolves InvalidOperationException on
/Items, /Items/Filters, /Users/{id}/Items/Latest, and /Studios
endpoints across all supported databases. See
EF_CORE_QUERY_TRANSLATION_FIX.md for details.
2026-03-05 17:17:16 -05:00
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
wjones 0eb44818ff Update config file logic and unify webDir path to wwwroot
- Prevent overwriting existing config files by only copying example files if the target does not exist.
- Set webDir to "wwwroot" for all OSes for consistency.
- Update last used publish profile to SelfContained-Win-x64.
2026-03-04 17:23:58 -05:00
wjones 667c3768a9 Enhanced logging & error handling for auth and pg backups
- Add detailed debug/warning logs to authentication flows (AuthService, AuthorizationContext, WebSocketManager) for better traceability of auth attempts and failures.
- Log WebSocket authentication attempts, including IP, path, and token preview.
- Introduce PostgresVersionMismatchException for pg_dump/pg_restore version mismatches; parse and log server/client versions, clean up failed backups, and provide upgrade guidance.
- Add helper for parsing version mismatch errors.
- Update using directives and minor code cleanups.
- Update .csproj.user with new publish profile path.
2026-03-04 12:37:39 -05:00
wjones 895372fe98 Move scripts to scripts directory and remove odcs no longer needed. 2026-03-03 17:10:46 -05:00
wjones c76853a442 PostgreSQL: Production fixes—UPSERT, remote backup, auth logs
- Fix: Atomic UPSERT for BaseItemProviders (resolves duplicate key errors during concurrent metadata refresh; clears navigation property to prevent EF Core tracking conflicts)
- Add: Remote PostgreSQL backup support (removes localhost-only restriction; works with pg_dump/pg_restore for both local and remote DBs)
- Add: Configurable backup disable option (`disable-backups`)
- Fix: Query timeout and performance (documented `command-timeout` config, added performance index scripts)
- Fix: Authentication errors now log as warnings with clear messages (ExceptionMiddleware), reducing log noise
- Fix: SyncPlay authorization handler validates user before lookup, logs warnings for unauthenticated/unknown users (returns 403/404)
- Fix: Database deadlock detection logs warnings and allows EF Core auto-retry
- Add: Configurable LibraryMonitorDelay (min 30s, default 60s)
- Fix: SQLite migration filtering—skip SQLite-only migrations on PostgreSQL
- Chore: Suppress StyleCop warnings (SA1137, etc.) for project consistency
- Docs: 21 documentation files added/updated (config, backup, performance, troubleshooting, session summary)
- All changes are backward compatible and production-ready
2026-03-03 16:35:27 -05:00
wjones 163a037642 Fix: skip SQLite backup requirements for non-SQLite DBs
Previously, the migration system would attempt to back up the legacy SQLite library.db file even when running with non-SQLite providers (e.g., PostgreSQL), causing startup errors. This was due to SQLite-specific migrations not being filtered out during backup requirement aggregation. This commit adds filtering to exclude migrations marked as RequiresSqlite from backup processing unless the provider is actually SQLite (currently unsupported). This prevents erroneous backup attempts and ensures only relevant migrations and backups are processed. Documentation has been updated to explain the issue and solution.
2026-03-02 10:12:20 -05:00
wjones 623af06e46 Optimize BaseItemRepository docs for grouping performance
Extensively document query grouping performance issues and optimization attempts in BaseItemRepository. Add guides on PostgreSQL UUID aggregation limitations, recommended indexes, increasing database timeouts, and monitoring query performance. Current code reverts to original (slow) implementation due to EF Core/Npgsql limitations, with detailed comments and references to new docs. Provides clear workarounds and upgrade path for future `.DistinctBy()` support.
2026-03-01 11:33:16 -05:00
wjones 23ed81b6b1 Improve build reliability, query perf, and documentation
- Add build-error-resolution.md guide for CS0006 and IDE analyzer issues
- Add rebuild-solution.ps1 script for clean/reliable builds
- Suppress noisy IDE/StyleCop warnings in .editorconfig
- Optimize BaseItemRepository grouping queries to use Min(Id) instead of FirstOrDefault, avoiding correlated subqueries and greatly improving DB performance
- Add database-query-optimization.md explaining query changes and tuning
- Enable EF Core SQL query logging, sensitive data, and detailed errors when log level is Debug (ServiceCollectionExtensions, logging.json)
- Update readme with SQL logging instructions
- Clarify git commit/ignore guidance and improve inline documentation
2026-03-01 09:49:30 -05:00
wjones dec2e5ac08 Add platform-specific startup config files for Linux/Windows
Remove old startup config references and add startup.json.linux and startup.json.windows with default directory paths for each platform. These files are now copied to output and publish directories, and include documentation on override priority.
2026-02-28 17:53:57 -05:00
wjones fbae233ce4 Add PostgreSQL config and update publish profile path
Added database.xml with PostgreSQL settings for Jellyfin, including connection and backup options. Updated Jellyfin.Server.csproj.user to reference a specific FolderProfile publish profile path.
2026-02-28 17:24:59 -05:00
wjones 61c71c1882 Update installer: add docs, scripts, and Start Menu tools
- Expanded [Files] section to include key documentation and PowerShell/batch scripts for database management
- Fixed INSTALLER_GUIDE.md path and improved file organization in installer script
- Added Start Menu shortcuts for documentation and database tools
- Updated .gitignore to track wwwroot/*
- Changed .csproj.user to use a relative publish profile name
- Added INSTALLER_NEEDS_UPDATE.md and INSTALLER_UPDATE_COMPLETE.md for documentation and change tracking
- Improves user onboarding, support, and maintainability
2026-02-28 16:45:58 -05:00
wjones 78c8d4256c Docs reorg, config refactor, and ItemValues index fix
- 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
2026-02-28 16:23:43 -05:00
wjones 5565dc3e05 Add automated PostgreSQL performance index management
- Add scripts and SQL for base and supplementary indexes (total 23)
- Integrate index checks and auto-creation into Jellyfin startup
- Update csproj to include SQL files in build/publish output
- Add diagnostics, publish/copy scripts, and troubleshooting docs
- Provide detailed guides for migration, verification, and merging
- Ensures robust, automated, and well-documented index setup
2026-02-28 15:13:04 -05:00
wjones 79110d2afd Update DataDir and ConfigDir paths in startup.json
Separated DataDir and ConfigDir into their own subfolders
within C:/ProgramData/jellyfin by updating their paths to
"data" and "config" respectively. This improves organization
of data and configuration files.
2026-02-27 18:12:52 -05:00
wjones 3e6aa54a8c Add Windows startup config and Jellyfin API test script
Added startup.json with Windows-specific default paths and documentation for Jellyfin configuration. Introduced test_api.py, a Python script to authenticate with Jellyfin, create a backup, and list backups using the REST API.
2026-02-27 18:10:36 -05:00
wjones 78bc22db79 Update BaseItemProviders after deletion in repository
Ensure entity.Provider is re-added to context after deleting
existing BaseItemProviders, preserving updated provider info.
2026-02-27 17:09:06 -05:00
wjones 33d7c010fb Jellyfin 11.0.0-PostgreSQL PREVIEW: version bump & defaults
- Update version to 11.0.0-PostgreSQL-PREVIEW in assemblies, installer, and build scripts
- Default web directory is now "wwwroot" across all platforms
- Configuration manager now creates .example files if missing
- Set PostgreSQL as default database with sensible options
- Postgres provider ensures database exists before table checks
- Add docs for marker conflict fixes and startup.json path issues
- Version string in logs/UI uses informational version
- Installer output filename and wizard show PREVIEW suffix
- Documentation summarizes version bump and verification steps
2026-02-27 13:45:09 -05:00
wjones d623cd03a9 Enable EF Core SplitQuery for PostgreSQL provider
Configured QuerySplittingBehavior.SplitQuery in PostgresDatabaseProvider to optimize performance for queries with multiple Include() statements. This prevents cartesian explosion, eliminates EF Core warnings, and aligns with best practices for handling related collections in PostgreSQL.
2026-02-26 17:51:11 -05:00
wjones 5197948fcc Remove SQLite runtime provider; keep for migration only
SQLite provider removed from service collection and runtime database options. Microsoft.Data.Sqlite package added to Jellyfin.Server for migration routines (SQLite → PostgreSQL). Migration service updated to always use PostgreSQL. SqliteExtensions restored for migration helpers. SQLite migration test deleted. Documentation added to explain migration-only support and deployment impact. No breaking changes for users migrating from SQLite; deployment size increases (~68 MB) for cross-platform SQLite DLLs.
2026-02-26 17:14:30 -05:00
wjones 27e4d11b15 Remove SQLite support for PostgreSQL-only deployment
- Removed SQLite provider project reference and NuGet package
- Added remove-sqlite.ps1 script for automated cleanup and verification
- Updated documentation and PR descriptions for PostgreSQL focus
- Provided migration guidance and detailed removal plan
- Reduced build output size and improved maintainability
2026-02-26 16:31:13 -05:00
wjones c51c14efde Docs: overhaul README, centralize docs, update .gitignore
- Rewrote README.md to highlight PostgreSQL features, installer, and migration, with quick start and full docs index
- Moved all markdown documentation files to docs/ for better organization; updated links accordingly
- Added .gitignore rules to exclude all PublishProfiles folders; removed tracked publish profile XMLs
- Preserved original README as README.original.md; added README_GENERATION.md and DOCUMENTATION_ORGANIZATION.md
- Cleaned root directory, improved navigation, and clarified platform-specific instructions
2026-02-26 15:50:19 -05:00
wjones cc870ead29 Add Windows installer scripts, docs, and startup.json fixes
Major improvements to the Jellyfin PostgreSQL Windows installer:
- Added build-installer.ps1 (PowerShell automation)
- Added jellyfin-setup.iss (Inno Setup script) and jellyfin.ico
- Added detailed installer guides and quick start docs
- Fixed startup.json defaults: removed old file, ensured Windows paths
- Updated .gitignore for installer-output and publish profiles
- Installer now supports service install, firewall setup, and PostgreSQL config wizard
- Documentation covers both quick and production-grade workflows
2026-02-26 15:29:12 -05:00
wjones 8f860a8ec3 Centralize build output and generate OS-specific startup.json
- All DLLs now output to lib\[Configuration]\[TargetFramework]\ at repo root (see Directory.Build.props)
- .gitignore updated to exclude /lib/
- On first run, startup.json is auto-generated with OS-appropriate default paths (Windows, Linux, macOS, or portable)
- Removes null/example config; generated config is immediately usable and clearly documented
- Extensive new documentation: build output, startup.json logic, visual guides, and code proofs
- Publish profile now deletes existing files for clean deploys
- No breaking changes: existing startup.json files are preserved
- Improves first-run UX, deployment, and cross-platform consistency
2026-02-26 14:21:26 -05:00
wjones 5bdb7d53c3 Platform config templates & Postgres migration recovery
- Added Linux/Windows startup config templates and README
- Updated default paths to FHS-compliant locations
- Improved publish profiles for platform targeting
- Enhanced Postgres migration: auto-recover on 42P07 errors
- Added RecordMigrationAsAppliedAsync for manual migration history
- Improved migration logging and error handling
- Added detailed documentation for config and migration fixes
2026-02-26 13:44:03 -05:00