diff --git a/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs b/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs index 14f38294a..7fe64acfe 100644 --- a/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs +++ b/src/NzbDrone.Core/Datastore/Migration/111_setup_music.cs @@ -31,6 +31,8 @@ namespace NzbDrone.Core.Datastore.Migration Create.TableForModel("Albums") .WithColumn("AlbumId").AsInt32() // Does this map to collectionId? + .WithColumn("CompilationId").AsInt32() + .WithColumn("Compilation").AsBoolean() .WithColumn("Title").AsString() .WithColumn("Year").AsInt32() .WithColumn("Image").AsInt32() // Is this needed? @@ -41,6 +43,8 @@ namespace NzbDrone.Core.Datastore.Migration Create.TableForModel("Tracks") .WithColumn("ItunesTrackId").AsInt32().Unique() .WithColumn("AlbumId").AsInt32() + .WithColumn("CompilationId").AsInt32().Nullable() + .WithColumn("Compilation").AsBoolean().WithDefaultValue("False") .WithColumn("TrackNumber").AsInt32() .WithColumn("Title").AsString().Nullable() .WithColumn("Ignored").AsBoolean().Nullable() @@ -61,6 +65,10 @@ namespace NzbDrone.Core.Datastore.Migration .WithColumn("Size").AsInt64() .WithColumn("DateAdded").AsDateTime() .WithColumn("AlbumId").AsInt32(); // How does this impact stand alone tracks? + + Create.TableForModel("Compilation") + .WithColumn("CompilationId").AsInt32().Unique() + .WithColumn("ArtistId").AsString().Nullable(); } } diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs index b48d48803..ce619b72b 100644 --- a/src/NzbDrone.Core/Datastore/TableMapping.cs +++ b/src/NzbDrone.Core/Datastore/TableMapping.cs @@ -112,6 +112,9 @@ namespace NzbDrone.Core.Datastore .Relationship() .HasOne(track => track.TrackFile, track => track.TrackFileId); + Mapper.Entity().RegisterModel("Compilation") + .Relationships.AutoMapICollectionOrComplexProperties(); //TODO: Figure out how to map this Table + Mapper.Entity().RegisterModel("QualityDefinitions") .Ignore(d => d.Weight); diff --git a/src/NzbDrone.Core/Music/Compilation.cs b/src/NzbDrone.Core/Music/Compilation.cs new file mode 100644 index 000000000..923e6d7f3 --- /dev/null +++ b/src/NzbDrone.Core/Music/Compilation.cs @@ -0,0 +1,19 @@ +using NzbDrone.Core.Datastore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NzbDrone.Core.Music +{ + public class Compilation : ModelBase + { + public Compilation() + { + + } + + public int CompilationId { get; set; } + public LazyList Artists { get; set; } + } +} diff --git a/src/NzbDrone.Core/Music/Track.cs b/src/NzbDrone.Core/Music/Track.cs index 27a61e58d..89793d514 100644 --- a/src/NzbDrone.Core/Music/Track.cs +++ b/src/NzbDrone.Core/Music/Track.cs @@ -19,6 +19,8 @@ namespace NzbDrone.Core.Music public int ItunesTrackId { get; set; } public int AlbumId { get; set; } + public int CompilationId { get; set; } + public bool Compilation { get; set; } public int TrackNumber { get; set; } public string Title { get; set; } public bool Ignored { get; set; }