You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Prowlarr/NzbDrone.Core/Datastore/MigrationsHelper.cs

51 lines
1.3 KiB

using System;
using System.Reflection;
using NLog;
namespace NzbDrone.Core.Datastore
{
14 years ago
public class MigrationsHelper
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public static bool IsMigrated { get; private set; }
public static void Run(string connetionString, bool trace)
{
if (IsMigrated) return;
IsMigrated = true;
Logger.Info("Preparing run database migration");
try
{
Migrator.Migrator migrator;
if (trace)
{
14 years ago
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(MigrationsHelper)), true, new MigrationLogger());
}
else
{
14 years ago
migrator = new Migrator.Migrator("Sqlite", connetionString, Assembly.GetAssembly(typeof(MigrationsHelper)));
}
migrator.MigrateToLastVersion();
//ForceSubSonicMigration(Connection.CreateSimpleRepository(connetionString));
Logger.Info("Database migration completed");
}
catch (Exception e)
{
Logger.FatalException("An error has occured while migrating database", e);
}
}
}
}