aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
diff options
context:
space:
mode:
authorJPVenson <github@jpb.email>2025-06-04 01:49:41 +0300
committerGitHub <noreply@github.com>2025-06-03 16:49:41 -0600
commitd5672ce407dda5e6e2422a7ce7ea6ad561759001 (patch)
tree18de4f39ae533012f36f42a569a392221097f7c1 /Jellyfin.Server/Migrations/Routines/FixAudioData.cs
parent0c46431cbb48850fae0e425e95692a1a9bbce427 (diff)
Add declarative backups for migrations (#14135)
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/FixAudioData.cs')
-rw-r--r--Jellyfin.Server/Migrations/Routines/FixAudioData.cs25
1 files changed, 1 insertions, 24 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/FixAudioData.cs b/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
index af8787b95..05ded06ba 100644
--- a/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
+++ b/Jellyfin.Server/Migrations/Routines/FixAudioData.cs
@@ -18,10 +18,10 @@ namespace Jellyfin.Server.Migrations.Routines
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
[JellyfinMigration("2025-04-20T18:00:00", nameof(FixAudioData), "CF6FABC2-9FBE-4933-84A5-FFE52EF22A58")]
+ [JellyfinMigrationBackup(LegacyLibraryDb = true)]
internal class FixAudioData : IMigrationRoutine
#pragma warning restore CS0618 // Type or member is obsolete
{
- private const string DbFilename = "library.db";
private readonly ILogger<FixAudioData> _logger;
private readonly IServerApplicationPaths _applicationPaths;
private readonly IItemRepository _itemRepository;
@@ -39,29 +39,6 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public void Perform()
{
- var dbPath = Path.Combine(_applicationPaths.DataPath, DbFilename);
-
- // Back up the database before modifying any entries
- for (int i = 1; ; i++)
- {
- var bakPath = string.Format(CultureInfo.InvariantCulture, "{0}.bak{1}", dbPath, i);
- if (!File.Exists(bakPath))
- {
- try
- {
- _logger.LogInformation("Backing up {Library} to {BackupPath}", DbFilename, bakPath);
- File.Copy(dbPath, bakPath);
- _logger.LogInformation("{Library} backed up to {BackupPath}", DbFilename, bakPath);
- break;
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, "Cannot make a backup of {Library} at path {BackupPath}", DbFilename, bakPath);
- throw;
- }
- }
- }
-
_logger.LogInformation("Backfilling audio lyrics data to database.");
var startIndex = 0;
var records = _itemRepository.GetCount(new InternalItemsQuery