diff options
| author | crobibero <cody@robibe.ro> | 2025-10-27 15:43:29 -0400 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2025-10-27 15:43:29 -0400 |
| commit | a489942454218fc968baf7858ee00ee9141ebfb5 (patch) | |
| tree | 540711d6132e49cf894e6626a14970f89e534158 /Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs | |
| parent | 423c2654c087e9c23fafe6766ccc7168b6b2dd3a (diff) | |
Backport pull request #15212 from jellyfin/release-10.11.z
Skip invalid database migration
Original-merge: 2966d27c97542fae111b54526326b8a93fcf7ca6
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs')
| -rw-r--r-- | Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs index a954d307e..b36db347c 100644 --- a/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs +++ b/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs @@ -55,9 +55,25 @@ namespace Jellyfin.Server.Migrations.Routines }; var dataPath = _paths.DataPath; - using (var connection = new SqliteConnection($"Filename={Path.Combine(dataPath, DbFilename)}")) + var activityLogPath = Path.Combine(dataPath, DbFilename); + if (!File.Exists(activityLogPath)) + { + _logger.LogWarning("{ActivityLogDb} doesn't exist, nothing to migrate", activityLogPath); + return; + } + + using (var connection = new SqliteConnection($"Filename={activityLogPath}")) { connection.Open(); + var tableQuery = connection.Query("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='ActivityLog';"); + foreach (var row in tableQuery) + { + if (row.GetInt32(0) == 0) + { + _logger.LogWarning("Table 'ActivityLog' doesn't exist in {ActivityLogPath}, nothing to migrate", activityLogPath); + break; + } + } using var userDbConnection = new SqliteConnection($"Filename={Path.Combine(dataPath, "users.db")}"); userDbConnection.Open(); |
