mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Migrations
Still need to remove System.Data.Sqlite, prefer an option in OrmLite to pluralize table names.
This commit is contained in:
parent
b9fac94eca
commit
4bb4faf626
29 changed files with 375 additions and 50 deletions
|
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
public JobDefinition GetDefinition(Type type)
|
||||
{
|
||||
return Single(c => c.TypeName == type.FullName);
|
||||
return Single(c => c.Type == type.FullName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -39,12 +39,12 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
public void Init()
|
||||
{
|
||||
var currentJobs = All();
|
||||
var currentJobs = All().ToList();
|
||||
_logger.Debug("Initializing jobs. Available: {0} Existing:{1}", _jobs.Count(), currentJobs.Count());
|
||||
|
||||
foreach (var currentJob in currentJobs)
|
||||
{
|
||||
if (_jobs.All(c => c.GetType().ToString() != currentJob.TypeName))
|
||||
if (_jobs.All(c => c.GetType().ToString() != currentJob.Type))
|
||||
{
|
||||
_logger.Debug("Removing job from database '{0}'", currentJob.Name);
|
||||
Delete(currentJob.Id);
|
||||
|
@ -53,13 +53,13 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
foreach (var job in _jobs)
|
||||
{
|
||||
var jobDefinition = currentJobs.SingleOrDefault(c => c.TypeName == job.GetType().ToString());
|
||||
var jobDefinition = currentJobs.SingleOrDefault(c => c.Type == job.GetType().ToString());
|
||||
|
||||
if (jobDefinition == null)
|
||||
{
|
||||
jobDefinition = new JobDefinition
|
||||
{
|
||||
TypeName = job.GetType().ToString(),
|
||||
Type = job.GetType().ToString(),
|
||||
LastExecution = DateTime.Now
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue