parent
853f25468c
commit
f345977e3f
@ -0,0 +1,23 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(128)]
|
||||
public class rename_quality_profiles_add_upgrade_allowed : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Rename.Table("Profiles").To("QualityProfiles");
|
||||
|
||||
Alter.Table("QualityProfiles").AddColumn("UpgradeAllowed").AsInt32().Nullable();
|
||||
Alter.Table("LanguageProfiles").AddColumn("UpgradeAllowed").AsInt32().Nullable();
|
||||
|
||||
// Set upgrade allowed for existing profiles (default will be false for new profiles)
|
||||
Update.Table("QualityProfiles").Set(new { UpgradeAllowed = true }).AllRows();
|
||||
Update.Table("LanguageProfiles").Set(new { UpgradeAllowed = true }).AllRows();
|
||||
|
||||
Rename.Column("ProfileId").OnTable("Series").To("QualityProfileId");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
using System.Net;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Qualities
|
||||
{
|
||||
public class ProfileInUseException : NzbDroneClientException
|
||||
{
|
||||
public ProfileInUseException(string name)
|
||||
: base(HttpStatusCode.BadRequest, "Profile [{0}] is in use.", name)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using System.Net;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Qualities
|
||||
{
|
||||
public class QualityProfileInUseException : NzbDroneClientException
|
||||
{
|
||||
public QualityProfileInUseException(string name)
|
||||
: base(HttpStatusCode.BadRequest, "QualityProfile [{0}] is in use.", name)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
namespace NzbDrone.Core.Profiles.Qualities
|
||||
{
|
||||
public interface IProfileRepository : IBasicRepository<QualityProfile>
|
||||
{
|
||||
bool Exists(int id);
|
||||
}
|
||||
|
||||
public class QualityProfileRepository : BasicRepository<QualityProfile>, IProfileRepository
|
||||
{
|
||||
public QualityProfileRepository(IMainDatabase database, IEventAggregator eventAggregator)
|
||||
: base(database, eventAggregator)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Exists(int id)
|
||||
{
|
||||
return DataMapper.Query<QualityProfile>().Where(p => p.Id == id).GetRowCount() == 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue