CRITICAL FIX: Also disable database migrations in JellyfinMigrationService - was running InitialCreate

This commit is contained in:
2026-03-08 10:50:00 -04:00
parent 2209f0e1c0
commit ac1c2c6c82
2 changed files with 12 additions and 1 deletions
@@ -3,7 +3,7 @@
"operationId": "02bc6448-a69d-4ff4-a0ec-0db07ec3a09a", "operationId": "02bc6448-a69d-4ff4-a0ec-0db07ec3a09a",
"description": "Upgrade solution or project to new version of .NET", "description": "Upgrade solution or project to new version of .NET",
"startTime": "2026-03-05T22:18:32.3921759Z", "startTime": "2026-03-05T22:18:32.3921759Z",
"lastUpdateTime": "2026-03-07T18:26:16.052623Z", "lastUpdateTime": "2026-03-08T14:46:31.3820237Z",
"stage": "Execution", "stage": "Execution",
"properties": {}, "properties": {},
"folderPath": "" "folderPath": ""
@@ -111,12 +111,15 @@ internal class JellyfinMigrationService
var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false); var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false);
await using (dbContext.ConfigureAwait(false)) await using (dbContext.ConfigureAwait(false))
{ {
// DISABLED for .NET 11 preview: Database creation handled by PostgresDatabaseProvider using SQL scripts
/*
var databaseCreator = dbContext.Database.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator var databaseCreator = dbContext.Database.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator
?? throw new InvalidOperationException("Jellyfin does only support relational databases."); ?? throw new InvalidOperationException("Jellyfin does only support relational databases.");
if (!await databaseCreator.ExistsAsync().ConfigureAwait(false)) if (!await databaseCreator.ExistsAsync().ConfigureAwait(false))
{ {
await databaseCreator.CreateAsync().ConfigureAwait(false); await databaseCreator.CreateAsync().ConfigureAwait(false);
} }
*/
var historyRepository = dbContext.GetService<IHistoryRepository>(); var historyRepository = dbContext.GetService<IHistoryRepository>();
@@ -235,13 +238,16 @@ internal class JellyfinMigrationService
var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false); var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false);
await using (dbContext.ConfigureAwait(false)) await using (dbContext.ConfigureAwait(false))
{ {
// DISABLED for .NET 11 preview: Database creation handled by PostgresDatabaseProvider using SQL scripts
// Ensure the migration history table exists before querying it // Ensure the migration history table exists before querying it
/*
var databaseCreator = dbContext.Database.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator; var databaseCreator = dbContext.Database.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator;
if (databaseCreator is not null && !await databaseCreator.ExistsAsync().ConfigureAwait(false)) if (databaseCreator is not null && !await databaseCreator.ExistsAsync().ConfigureAwait(false))
{ {
logger.LogInformation("Database does not exist, creating..."); logger.LogInformation("Database does not exist, creating...");
await databaseCreator.CreateAsync().ConfigureAwait(false); await databaseCreator.CreateAsync().ConfigureAwait(false);
} }
*/
var historyRepository = dbContext.GetService<IHistoryRepository>(); var historyRepository = dbContext.GetService<IHistoryRepository>();
@@ -256,12 +262,17 @@ internal class JellyfinMigrationService
.ToArray(); .ToArray();
(string Key, InternalDatabaseMigration Migration)[] pendingDatabaseMigrations = []; (string Key, InternalDatabaseMigration Migration)[] pendingDatabaseMigrations = [];
// DISABLED for .NET 11 preview: EF Core database migrations don't work with preview SDK
// Database schema is initialized from SQL scripts in PostgresDatabaseProvider instead
/*
if (stage is JellyfinMigrationStageTypes.CoreInitialisation) if (stage is JellyfinMigrationStageTypes.CoreInitialisation)
{ {
pendingDatabaseMigrations = migrationsAssembly.Migrations.Where(f => appliedMigrations.All(e => e.MigrationId != f.Key)) pendingDatabaseMigrations = migrationsAssembly.Migrations.Where(f => appliedMigrations.All(e => e.MigrationId != f.Key))
.Select(e => (Key: e.Key, Migration: new InternalDatabaseMigration(e, dbContext))) .Select(e => (Key: e.Key, Migration: new InternalDatabaseMigration(e, dbContext)))
.ToArray(); .ToArray();
} }
*/
(string Key, IInternalMigration Migration)[] pendingMigrations = [.. pendingCodeMigrations, .. pendingDatabaseMigrations]; (string Key, IInternalMigration Migration)[] pendingMigrations = [.. pendingCodeMigrations, .. pendingDatabaseMigrations];
logger.LogInformation("There are {Pending} migrations for stage {Stage}.", pendingMigrations.Length, stage); logger.LogInformation("There are {Pending} migrations for stage {Stage}.", pendingMigrations.Length, stage);