mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-17 10:45:49 +02:00
removed migrationcache
This commit is contained in:
parent
abd994ef71
commit
5117eaaf5c
@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using FluentMigrator.Runner;
|
||||
using FluentMigrator.Runner.Initialization;
|
||||
using FluentMigrator.Runner.Processors.Sqlite;
|
||||
@ -17,8 +16,6 @@ public class MigrationController : IMigrationController
|
||||
private readonly ISQLiteAlter _sqLiteAlter;
|
||||
private readonly ISqLiteMigrationHelper _migrationHelper;
|
||||
|
||||
private static readonly HashSet<string> MigrationCache = new HashSet<string>();
|
||||
|
||||
public MigrationController(IAnnouncer announcer, ISQLiteAlter sqLiteAlter, ISqLiteMigrationHelper migrationHelper)
|
||||
{
|
||||
_announcer = announcer;
|
||||
@ -28,33 +25,26 @@ public MigrationController(IAnnouncer announcer, ISQLiteAlter sqLiteAlter, ISqLi
|
||||
|
||||
public void MigrateToLatest(string connectionString, MigrationType migrationType)
|
||||
{
|
||||
lock (MigrationCache)
|
||||
{
|
||||
if (MigrationCache.Contains(connectionString.ToLower())) return;
|
||||
_announcer.Heading("Migrating " + connectionString);
|
||||
|
||||
_announcer.Heading("Migrating " + connectionString);
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var migrationContext = new RunnerContext(_announcer)
|
||||
{
|
||||
Namespace = "NzbDrone.Core.Datastore.Migration",
|
||||
ApplicationContext = new MigrationContext
|
||||
{
|
||||
MigrationType = migrationType,
|
||||
SQLiteAlter = _sqLiteAlter,
|
||||
MigrationHelper = _migrationHelper,
|
||||
}
|
||||
};
|
||||
|
||||
var migrationContext = new RunnerContext(_announcer)
|
||||
{
|
||||
Namespace = "NzbDrone.Core.Datastore.Migration",
|
||||
ApplicationContext = new MigrationContext
|
||||
{
|
||||
MigrationType = migrationType,
|
||||
SQLiteAlter = _sqLiteAlter,
|
||||
MigrationHelper = _migrationHelper,
|
||||
}
|
||||
};
|
||||
|
||||
var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
|
||||
var factory = new SqliteProcessorFactory();
|
||||
var processor = factory.Create(connectionString, _announcer, options);
|
||||
var runner = new MigrationRunner(assembly, migrationContext, processor);
|
||||
runner.MigrateUp(true);
|
||||
|
||||
MigrationCache.Add(connectionString.ToLower());
|
||||
}
|
||||
var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 };
|
||||
var factory = new SqliteProcessorFactory();
|
||||
var processor = factory.Create(connectionString, _announcer, options);
|
||||
var runner = new MigrationRunner(assembly, migrationContext, processor);
|
||||
runner.MigrateUp(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user