From 9a99572354ab4ca5ae568cc44237d6ec6ff2e2d4 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:44:07 -0500 Subject: [PATCH] Scaffold Jellyfin.Database.Providers.PostgreSQL project (#4) * Initial plan * Issue 1.1: Scaffold PostgreSQL provider project Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com> --- Directory.Packages.props | 1 + Jellyfin.sln | 7 ++ ...lyfin.Database.Providers.PostgreSQL.csproj | 31 ++++++++ .../PostgreSqlDatabaseProvider.cs | 71 +++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/Jellyfin.Database.Providers.PostgreSQL.csproj create mode 100644 src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/PostgreSqlDatabaseProvider.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index 7afc4aa763..8d6591c7d3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -54,6 +54,7 @@ + diff --git a/Jellyfin.sln b/Jellyfin.sln index fb1f2a2c20..fd308c9b37 100644 --- a/Jellyfin.sln +++ b/Jellyfin.sln @@ -94,6 +94,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Jellyfin.Database", "Jellyf EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Database.Providers.Sqlite", "src\Jellyfin.Database\Jellyfin.Database.Providers.Sqlite\Jellyfin.Database.Providers.Sqlite.csproj", "{A5590358-33CC-4B39-BDE7-DC62FEB03C76}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Database.Providers.PostgreSQL", "src\Jellyfin.Database\Jellyfin.Database.Providers.PostgreSQL\Jellyfin.Database.Providers.PostgreSQL.csproj", "{B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Database.Implementations", "src\Jellyfin.Database\Jellyfin.Database.Implementations\Jellyfin.Database.Implementations.csproj", "{8C9F9221-8415-496C-B1F5-E7756F03FA59}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.CodeAnalysis", "src\Jellyfin.CodeAnalysis\Jellyfin.CodeAnalysis.csproj", "{11643D0F-6761-4EF7-AB71-6F9F8DE00714}" @@ -256,6 +258,10 @@ Global {A5590358-33CC-4B39-BDE7-DC62FEB03C76}.Debug|Any CPU.Build.0 = Debug|Any CPU {A5590358-33CC-4B39-BDE7-DC62FEB03C76}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5590358-33CC-4B39-BDE7-DC62FEB03C76}.Release|Any CPU.Build.0 = Release|Any CPU + {B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E}.Release|Any CPU.Build.0 = Release|Any CPU {8C9F9221-8415-496C-B1F5-E7756F03FA59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8C9F9221-8415-496C-B1F5-E7756F03FA59}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C9F9221-8415-496C-B1F5-E7756F03FA59}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -294,6 +300,7 @@ Global {8C6B2B13-58A4-4506-9DAB-1F882A093FE0} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C} {4C54CE05-69C8-48FA-8785-39F7F6DB1CAD} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C} {A5590358-33CC-4B39-BDE7-DC62FEB03C76} = {4C54CE05-69C8-48FA-8785-39F7F6DB1CAD} + {B3C4D5E6-F7A8-4B9C-0D1E-2F3A4B5C6D7E} = {4C54CE05-69C8-48FA-8785-39F7F6DB1CAD} {8C9F9221-8415-496C-B1F5-E7756F03FA59} = {4C54CE05-69C8-48FA-8785-39F7F6DB1CAD} {11643D0F-6761-4EF7-AB71-6F9F8DE00714} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C} EndGlobalSection diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/Jellyfin.Database.Providers.PostgreSQL.csproj b/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/Jellyfin.Database.Providers.PostgreSQL.csproj new file mode 100644 index 0000000000..2d23f99a54 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/Jellyfin.Database.Providers.PostgreSQL.csproj @@ -0,0 +1,31 @@ + + + + net10.0 + false + true + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + diff --git a/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/PostgreSqlDatabaseProvider.cs b/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/PostgreSqlDatabaseProvider.cs new file mode 100644 index 0000000000..7b9301c431 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Providers.PostgreSQL/PostgreSqlDatabaseProvider.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Jellyfin.Database.Implementations; +using Jellyfin.Database.Implementations.DbConfiguration; +using Microsoft.EntityFrameworkCore; + +namespace Jellyfin.Database.Providers.PostgreSQL; + +/// +/// Configures Jellyfin to use a PostgreSQL database. +/// +[JellyfinDatabaseProviderKey("Jellyfin-PostgreSQL")] +public sealed class PostgreSqlDatabaseProvider : IJellyfinDatabaseProvider +{ + /// + public IDbContextFactory? DbContextFactory { get; set; } + + /// + public void Initialise(DbContextOptionsBuilder options, DatabaseConfigurationOptions databaseConfiguration) + { + throw new NotImplementedException(); + } + + /// + public void OnModelCreating(ModelBuilder modelBuilder) + { + } + + /// + public void ConfigureConventions(ModelConfigurationBuilder configurationBuilder) + { + } + + /// + public Task RunScheduledOptimisation(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + /// + public Task RunShutdownTask(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + /// + public Task MigrationBackupFast(CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + /// + public Task RestoreBackupFast(string key, CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + + /// + public Task DeleteBackup(string key) + { + throw new NotImplementedException(); + } + + /// + public Task PurgeDatabase(JellyfinDbContext dbContext, IEnumerable? tableNames) + { + throw new NotImplementedException(); + } +}