1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-03-05 15:15:59 +02:00
Sonarr/NzbDrone.Core/Datastore/Migrations/NzbDroneMigration.cs

52 lines
1.3 KiB
C#
Raw Normal View History

using System;
2013-02-16 14:44:35 -08:00
using System.Data.Common;
2013-02-16 11:23:31 -08:00
using System.Data.SqlClient;
using System.Linq;
2013-02-16 14:44:35 -08:00
using System.Reflection;
using Migrator.Framework;
using NzbDrone.Common;
namespace NzbDrone.Core.Datastore.Migrations
{
public abstract class NzbDroneMigration : Migration
{
protected virtual void MainDbUpgrade()
{
}
protected virtual void LogDbUpgrade()
{
}
public override void Up()
{
2013-02-03 17:27:34 -08:00
if (Database.ConnectionString.Contains(PathExtentions.NZBDRONE_SQLCE_DB_FILE))
{
MainDbUpgrade();
}
2013-02-03 17:27:34 -08:00
else if (Database.ConnectionString.Contains(PathExtentions.LOG_SQLCE_DB_FILE))
{
LogDbUpgrade();
}
else
{
LogDbUpgrade();
MainDbUpgrade();
}
}
2013-02-03 20:18:59 -08:00
protected EloqueraDb GetObjectDb()
{
2013-02-16 14:44:35 -08:00
var sqlCeConnection = SqlCeProxy.EnsureDatabase(Database.ConnectionString);
2013-02-03 20:18:59 -08:00
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq");
return new EloqueraDbFactory(new EnvironmentProvider()).Create(eqPath);
}
public override void Down()
{
throw new NotImplementedException();
}
}
}