Fixed migration issue
This commit is contained in:
parent
57690f49a0
commit
72af060d68
|
@ -57,7 +57,6 @@ namespace NzbDrone.Core
|
||||||
LogConfiguration.Setup();
|
LogConfiguration.Setup();
|
||||||
|
|
||||||
Migrations.Run(Connection.MainConnectionString, true);
|
Migrations.Run(Connection.MainConnectionString, true);
|
||||||
ForceMigration(_kernel.Get<IRepository>());
|
|
||||||
|
|
||||||
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
||||||
|
|
||||||
|
@ -134,16 +133,6 @@ namespace NzbDrone.Core
|
||||||
_kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
|
_kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ForceMigration(IRepository repository)
|
|
||||||
{
|
|
||||||
repository.All<Series>().Count();
|
|
||||||
repository.All<Episode>().Count();
|
|
||||||
repository.All<EpisodeFile>().Count();
|
|
||||||
repository.All<QualityProfile>().Count();
|
|
||||||
repository.All<History>().Count();
|
|
||||||
repository.All<IndexerSetting>().Count();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Forces IISExpress process to exit with the host application
|
/// Forces IISExpress process to exit with the host application
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -7,7 +7,9 @@ using System.Text;
|
||||||
using Migrator.Framework;
|
using Migrator.Framework;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.Extensions;
|
using SubSonic.Extensions;
|
||||||
|
using SubSonic.Repository;
|
||||||
using SubSonic.Schema;
|
using SubSonic.Schema;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore
|
namespace NzbDrone.Core.Datastore
|
||||||
|
@ -36,7 +38,11 @@ namespace NzbDrone.Core.Datastore
|
||||||
|
|
||||||
migrator.MigrateToLastVersion();
|
migrator.MigrateToLastVersion();
|
||||||
|
|
||||||
|
ForceSubSonicMigration(Connection.CreateSimpleRepository(connetionString));
|
||||||
|
|
||||||
Logger.Info("Database migration completed");
|
Logger.Info("Database migration completed");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -44,6 +50,16 @@ namespace NzbDrone.Core.Datastore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ForceSubSonicMigration(IRepository repository)
|
||||||
|
{
|
||||||
|
repository.Single<Series>(1);
|
||||||
|
repository.Single<Episode>(1);
|
||||||
|
repository.Single<EpisodeFile>(1);
|
||||||
|
repository.Single<QualityProfile>(1);
|
||||||
|
repository.Single<History>(1);
|
||||||
|
repository.Single<IndexerSetting>(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void RemoveDeletedColumns(ITransformationProvider transformationProvider)
|
public static void RemoveDeletedColumns(ITransformationProvider transformationProvider)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +149,8 @@ namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
public override void Up()
|
public override void Up()
|
||||||
{
|
{
|
||||||
|
Migrations.ForceSubSonicMigration(Connection.CreateSimpleRepository(Connection.MainConnectionString));
|
||||||
|
|
||||||
var episodesTable = RepositoryProvider.EpisodesSchema;
|
var episodesTable = RepositoryProvider.EpisodesSchema;
|
||||||
//Database.AddIndex("idx_episodes_series_season_episode", episodesTable.Name, true,
|
//Database.AddIndex("idx_episodes_series_season_episode", episodesTable.Name, true,
|
||||||
// episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
// episodesTable.GetColumnByPropertyName("SeriesId").Name,
|
||||||
|
|
Loading…
Reference in New Issue