public void Migrate(string connectionString, MigrationContext migrationContext) { var sw = Stopwatch.StartNew(); _announcer.Heading("Migrating " + connectionString); var assembly = Assembly.GetExecutingAssembly(); var runnerContext = new RunnerContext(_announcer) { Namespace = "NzbDrone.Core.Datastore.Migration", ApplicationContext = migrationContext }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var factory = new NzbDroneSqliteProcessorFactory(); var processor = factory.Create(connectionString, _announcer, options); var runner = new MigrationRunner(assembly, runnerContext, processor); if (migrationContext.DesiredVersion.HasValue) { runner.MigrateUp(migrationContext.DesiredVersion.Value, true); } else { runner.MigrateUp(true); } sw.Stop(); _announcer.ElapsedTime(sw.Elapsed); }
public void MigrateToLatest(string connectionString, MigrationType migrationType) { _announcer.Heading("Migrating " + connectionString); var assembly = Assembly.GetExecutingAssembly(); 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); }
public void MigrateToLatest(string connectionString, MigrationType migrationType) { lock (MigrationCache) { if (MigrationCache.Contains(connectionString.ToLower())) return; _announcer.Heading("Migrating " + connectionString); var assembly = Assembly.GetExecutingAssembly(); 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()); } }
public void MigrateToLatest(string connectionString, MigrationType migrationType, Action <NzbDroneMigrationBase> beforeMigration) { var sw = Stopwatch.StartNew(); _announcer.Heading("Migrating " + connectionString); var assembly = Assembly.GetExecutingAssembly(); var migrationContext = new RunnerContext(_announcer) { Namespace = "NzbDrone.Core.Datastore.Migration", ApplicationContext = new MigrationContext(migrationType, beforeMigration) }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var factory = new NzbDroneSqliteProcessorFactory(); var processor = factory.Create(connectionString, _announcer, options); var runner = new MigrationRunner(assembly, migrationContext, processor); runner.MigrateUp(true); sw.Stop(); _announcer.ElapsedTime(sw.Elapsed); }
public void MigrateToLatest(string connectionString, MigrationType migrationType, Action<NzbDroneMigrationBase> beforeMigration) { var sw = Stopwatch.StartNew(); _announcer.Heading("Migrating " + connectionString); var assembly = Assembly.GetExecutingAssembly(); var migrationContext = new RunnerContext(_announcer) { Namespace = "NzbDrone.Core.Datastore.Migration", ApplicationContext = new MigrationContext(migrationType, beforeMigration) }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var factory = new NzbDroneSqliteProcessorFactory(); var processor = factory.Create(connectionString, _announcer, options); var runner = new MigrationRunner(assembly, migrationContext, processor); runner.MigrateUp(true); sw.Stop(); _announcer.ElapsedTime(sw.Elapsed); }