1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Core/Datastore/Migrations/NzbDroneMigration.cs

51 lines
1.2 KiB
C#
Raw Normal View History

using System;
2013-02-04 07:18:59 +03:00
using System.Data.SqlServerCe;
using System.Linq;
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-04 04:27:34 +03:00
if (Database.ConnectionString.Contains(PathExtentions.NZBDRONE_SQLCE_DB_FILE))
{
MainDbUpgrade();
}
2013-02-04 04:27:34 +03:00
else if (Database.ConnectionString.Contains(PathExtentions.LOG_SQLCE_DB_FILE))
{
LogDbUpgrade();
}
else
{
LogDbUpgrade();
MainDbUpgrade();
}
}
2013-02-04 07:18:59 +03:00
protected EloqueraDb GetObjectDb()
{
var sqlCeConnection = new SqlCeConnection(Database.ConnectionString);
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq");
return new EloqueraDbFactory(new EnvironmentProvider()).Create(eqPath);
}
public override void Down()
{
throw new NotImplementedException();
}
}
}