Refactor database configuration and migrations for PostgreSQL support

- Updated default database configuration to use PostgreSQL instead of SQLite when no database.xml exists.
- Removed obsolete migration routines: MigrateUserDb, RemoveDuplicateExtras, ReseedFolderFlag.
- Introduced new read-only view projections for PostgreSQL: ItemPersonView, ItemProviderView, LibrarySummaryView, MediaStreamInfoView, UserPlaybackHistoryView, VideoItemView.
- Registered view mappings in PostgresDatabaseProvider to ensure proper handling of read-only views.
- Cleaned up unused SQLite cache size configuration in ConfigurationExtensions.

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-30 18:47:48 -04:00
parent 9fc10226c9
commit e1f7a4bee9
15 changed files with 637 additions and 429 deletions
@@ -99,23 +99,13 @@ public static class ServiceCollectionExtensions
}
else
{
// when nothing is setup via new Database configuration, fallback to SQLite with default settings.
// PostgreSQL-only build: default to PostgreSQL when no database.xml exists.
efCoreConfiguration = new DatabaseConfigurationOptions()
{
DatabaseType = "Jellyfin-SQLite",
DatabaseType = "Jellyfin-PostgreSQL",
LockingBehavior = DatabaseLockingBehaviorTypes.NoLock,
PresetConfigurations =
[
new PresetConfigurationItem
{
Key = "SQLite",
Value = new PresetDatabaseConfiguration
{
DatabaseType = "Jellyfin-SQLite",
LockingBehavior = DatabaseLockingBehaviorTypes.NoLock,
Description = "Default SQLite database configuration. Database stored in data directory."
}
},
new PresetConfigurationItem
{
Key = "PostgreSQL-Local",
@@ -135,7 +125,7 @@ public static class ServiceCollectionExtensions
// Ensure DatabaseType is set (handle corrupted or empty configuration files)
if (string.IsNullOrWhiteSpace(efCoreConfiguration.DatabaseType))
{
efCoreConfiguration.DatabaseType = "Jellyfin-SQLite";
efCoreConfiguration.DatabaseType = "Jellyfin-PostgreSQL";
configurationManager.SaveConfiguration("database", efCoreConfiguration);
}