From 72af060d68f4cae4827b54e7849cf22c6b1b0650 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 4 Jun 2011 23:35:03 -0700 Subject: [PATCH] Fixed migration issue --- NzbDrone.Core/CentralDispatch.cs | 11 ----------- NzbDrone.Core/Datastore/Migrations.cs | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 621256685..89fa5766c 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -57,7 +57,6 @@ namespace NzbDrone.Core LogConfiguration.Setup(); Migrations.Run(Connection.MainConnectionString, true); - ForceMigration(_kernel.Get()); SetupDefaultQualityProfiles(_kernel.Get()); //Setup the default QualityProfiles on start-up @@ -134,16 +133,6 @@ namespace NzbDrone.Core _kernel.Get().InitializeNotifiers(notifiers.ToList()); } - private static void ForceMigration(IRepository repository) - { - repository.All().Count(); - repository.All().Count(); - repository.All().Count(); - repository.All().Count(); - repository.All().Count(); - repository.All().Count(); - } - /// /// Forces IISExpress process to exit with the host application /// diff --git a/NzbDrone.Core/Datastore/Migrations.cs b/NzbDrone.Core/Datastore/Migrations.cs index 91330a07c..b87f8589f 100644 --- a/NzbDrone.Core/Datastore/Migrations.cs +++ b/NzbDrone.Core/Datastore/Migrations.cs @@ -7,7 +7,9 @@ using System.Text; using Migrator.Framework; using NLog; using NzbDrone.Core.Repository; +using NzbDrone.Core.Repository.Quality; using SubSonic.Extensions; +using SubSonic.Repository; using SubSonic.Schema; namespace NzbDrone.Core.Datastore @@ -36,7 +38,11 @@ namespace NzbDrone.Core.Datastore migrator.MigrateToLastVersion(); + ForceSubSonicMigration(Connection.CreateSimpleRepository(connetionString)); + Logger.Info("Database migration completed"); + + } catch (Exception e) { @@ -44,6 +50,16 @@ namespace NzbDrone.Core.Datastore } } + public static void ForceSubSonicMigration(IRepository repository) + { + repository.Single(1); + repository.Single(1); + repository.Single(1); + repository.Single(1); + repository.Single(1); + repository.Single(1); + } + public static void RemoveDeletedColumns(ITransformationProvider transformationProvider) { @@ -133,6 +149,8 @@ namespace NzbDrone.Core.Datastore { public override void Up() { + Migrations.ForceSubSonicMigration(Connection.CreateSimpleRepository(Connection.MainConnectionString)); + var episodesTable = RepositoryProvider.EpisodesSchema; //Database.AddIndex("idx_episodes_series_season_episode", episodesTable.Name, true, // episodesTable.GetColumnByPropertyName("SeriesId").Name,