mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Add declarative backups for migrations (#14135)
This commit is contained in:
@@ -64,6 +64,13 @@ public interface IJellyfinDatabaseProvider
|
||||
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
|
||||
Task RestoreBackupFast(string key, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a backup that has been previously created by <see cref="MigrationBackupFast(CancellationToken)"/>.
|
||||
/// </summary>
|
||||
/// <param name="key">The key to the backup which should be cleaned up.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
|
||||
Task DeleteBackup(string key);
|
||||
|
||||
/// <summary>
|
||||
/// Removes all contents from the database.
|
||||
/// </summary>
|
||||
|
||||
@@ -129,6 +129,21 @@ public sealed class SqliteDatabaseProvider : IJellyfinDatabaseProvider
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task DeleteBackup(string key)
|
||||
{
|
||||
var backupFile = Path.Combine(_applicationPaths.DataPath, BackupFolderName, $"{key}_jellyfin.db");
|
||||
|
||||
if (!File.Exists(backupFile))
|
||||
{
|
||||
_logger.LogCritical("Tried to delete a backup that does not exist: {Key}", key);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
File.Delete(backupFile);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async Task PurgeDatabase(JellyfinDbContext dbContext, IEnumerable<string>? tableNames)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user