mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 01:05:19 +03:00
Delete old migrations on restore (#14486)
This commit is contained in:
@@ -165,6 +165,13 @@ public class BackupService : IBackupService
|
|||||||
|
|
||||||
var historyRepository = dbContext.GetService<IHistoryRepository>();
|
var historyRepository = dbContext.GetService<IHistoryRepository>();
|
||||||
await historyRepository.CreateIfNotExistsAsync().ConfigureAwait(false);
|
await historyRepository.CreateIfNotExistsAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
|
foreach (var item in await historyRepository.GetAppliedMigrationsAsync(CancellationToken.None).ConfigureAwait(false))
|
||||||
|
{
|
||||||
|
var insertScript = historyRepository.GetDeleteScript(item.MigrationId);
|
||||||
|
await dbContext.Database.ExecuteSqlRawAsync(insertScript).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in historyEntries)
|
foreach (var item in historyEntries)
|
||||||
{
|
{
|
||||||
var insertScript = historyRepository.GetInsertScript(item);
|
var insertScript = historyRepository.GetInsertScript(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user