Fix backup not written to correct directory (#13853)

* Fix backup not written to correct directory

* Improve restore handling and only restore on actual error

* Fix first failed migration not causing a rollback
This commit is contained in:
JPVenson
2025-04-07 16:59:00 +02:00
committed by GitHub
parent e1ef4290af
commit 04ca27ad07
2 changed files with 30 additions and 7 deletions

View File

@@ -98,7 +98,7 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
Directory.CreateDirectory(backupFile);
}
backupFile = Path.Combine(_applicationPaths.DataPath, $"{key}_jellyfin.db");
backupFile = Path.Combine(backupFile, $"{key}_jellyfin.db");
File.Copy(path, backupFile);
return Task.FromResult(key);
}
@@ -106,6 +106,8 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
/// <inheritdoc />
public Task RestoreBackupFast(string key, CancellationToken cancellationToken)
{
// ensure there are absolutly no dangling Sqlite connections.
SqliteConnection.ClearAllPools();
var path = Path.Combine(_applicationPaths.DataPath, "jellyfin.db");
var backupFile = Path.Combine(_applicationPaths.DataPath, BackupFolderName, $"{key}_jellyfin.db");