2013-03-25 04:36:24 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
2013-03-25 06:13:53 +00:00
|
|
|
|
namespace NzbDrone.Core.Datastore.Migration.Framework
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
2013-03-25 06:13:53 +00:00
|
|
|
|
public abstract class NzbDroneMigrationBase : FluentMigrator.Migration
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
|
|
|
|
protected virtual void MainDbUpgrade()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void LogDbUpgrade()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Up()
|
|
|
|
|
{
|
2013-07-05 03:56:27 +00:00
|
|
|
|
var context = (MigrationContext)ApplicationContext;
|
|
|
|
|
|
|
|
|
|
SQLiteAlter = context.SQLiteAlter;
|
|
|
|
|
|
|
|
|
|
switch (context.MigrationType)
|
2013-03-25 04:36:24 +00:00
|
|
|
|
{
|
2013-06-19 01:01:08 +00:00
|
|
|
|
case MigrationType.Main:
|
|
|
|
|
MainDbUpgrade();
|
|
|
|
|
return;
|
|
|
|
|
case MigrationType.Log:
|
|
|
|
|
LogDbUpgrade();
|
|
|
|
|
return;
|
|
|
|
|
default:
|
|
|
|
|
LogDbUpgrade();
|
|
|
|
|
MainDbUpgrade();
|
|
|
|
|
return;
|
2013-03-25 04:36:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-05 03:56:27 +00:00
|
|
|
|
public ISQLiteAlter SQLiteAlter { get; private set; }
|
2013-03-25 04:36:24 +00:00
|
|
|
|
|
|
|
|
|
public override void Down()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|