feat: implement migration tracking and history management for PostgreSQL

This commit is contained in:
2026-05-04 12:47:12 -04:00
parent e67c191843
commit 4ccd84342b
12 changed files with 191 additions and 192 deletions
@@ -113,7 +113,6 @@ public sealed class BulkOperationTransaction : IAsyncDisposable, IDisposable
_transaction?.Dispose();
_transaction = null;
_disposed = true;
GC.SuppressFinalize(this);
}
/// <summary>
@@ -134,7 +133,6 @@ public sealed class BulkOperationTransaction : IAsyncDisposable, IDisposable
_transaction = null;
_disposed = true;
GC.SuppressFinalize(this);
}
}
@@ -289,7 +289,6 @@ public sealed class PostgresDatabaseProvider : IJellyfinDatabaseProvider
maxRetryDelay: TimeSpan.FromSeconds(5),
errorCodesToAdd: new[] { "57P01" }); // Add "terminating connection" to retryable errors
})
.ReplaceService<Microsoft.EntityFrameworkCore.Migrations.IHistoryRepository, SnakeCaseHistoryRepository>()
.ConfigureWarnings(warnings =>
warnings.Ignore(Microsoft.EntityFrameworkCore.Diagnostics.RelationalEventId.PendingModelChangesWarning));
@@ -1,33 +0,0 @@
// <copyright file="SnakeCaseHistoryRepository.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
#pragma warning disable EF1001 // NpgsqlHistoryRepository is an internal EF Core infrastructure type; intentional use in this PostgreSQL fork.
namespace Jellyfin.Database.Providers.Postgres;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Migrations.Internal;
/// <summary>
/// A custom history repository that uses snake_case column names for the
/// <c>__EFMigrationsHistory</c> table, matching the PostgreSQL naming convention
/// used throughout this fork.
/// </summary>
public sealed class SnakeCaseHistoryRepository : NpgsqlHistoryRepository
{
/// <summary>
/// Initializes a new instance of the <see cref="SnakeCaseHistoryRepository"/> class.
/// </summary>
/// <param name="dependencies">Repository dependencies injected by EF Core.</param>
public SnakeCaseHistoryRepository(HistoryRepositoryDependencies dependencies)
: base(dependencies)
{
}
/// <inheritdoc/>
protected override string MigrationIdColumnName => "migration_id";
/// <inheritdoc/>
protected override string ProductVersionColumnName => "product_version";
}