jellyfin/MediaBrowser.Server.Startup.Common/Migrations/DbMigration.cs

33 lines
993 B
C#
Raw Normal View History

2015-10-29 13:28:05 +00:00
using System.Threading.Tasks;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Server.Implementations.Persistence;
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class DbMigration : IVersionMigration
{
private readonly IServerConfigurationManager _config;
private readonly ITaskManager _taskManager;
public DbMigration(IServerConfigurationManager config, ITaskManager taskManager)
{
_config = config;
_taskManager = taskManager;
}
public void Run()
{
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
{
2015-11-02 17:25:01 +00:00
Task.Run(async () =>
{
await Task.Delay(2000).ConfigureAwait(false);
2015-10-29 13:28:05 +00:00
2015-11-02 17:25:01 +00:00
_taskManager.QueueScheduledTask<CleanDatabaseScheduledTask>();
});
}
2015-10-29 13:28:05 +00:00
}
}
}