A lot more lidarr work, i'm done for the day wow... !wip #2313

This commit is contained in:
Jamie 2018-08-24 23:02:40 +01:00
parent 207c60b7f8
commit 3750243f11
19 changed files with 174 additions and 94 deletions

View file

@ -12,8 +12,6 @@ namespace Ombi.Store.Entities
public DateTime ReleaseDate { get; set; }
public bool Monitored { get; set; }
public string Title { get; set; }
[ForeignKey(nameof(ArtistId))]
public LidarrArtistCache Artist { get; set; }
public decimal PercentOfTracks { get; set; }
}
}

View file

@ -6,12 +6,9 @@ namespace Ombi.Store.Entities
[Table("LidarrArtistCache")]
public class LidarrArtistCache : Entity
{
[ForeignKey(nameof(ArtistId))]
public int ArtistId { get; set; }
public string ArtistName { get; set; }
public string ForeignArtistId { get; set; }
public bool Monitored { get; set; }
public List<LidarrAlbumCache> Albums { get; set; }
}
}

View file

@ -9,7 +9,7 @@ using Ombi.Store.Context;
namespace Ombi.Store.Migrations
{
[DbContext(typeof(OmbiContext))]
[Migration("20180824202308_LidarrSyncJobs")]
[Migration("20180824211553_LidarrSyncJobs")]
partial class LidarrSyncJobs
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -257,6 +257,8 @@ namespace Ombi.Store.Migrations
b.Property<bool>("Monitored");
b.Property<decimal>("PercentOfTracks");
b.Property<DateTime>("ReleaseDate");
b.Property<string>("Title");
@ -265,8 +267,6 @@ namespace Ombi.Store.Migrations
b.HasKey("Id");
b.HasIndex("ArtistId");
b.ToTable("LidarrAlbumCache");
});
@ -965,14 +965,6 @@ namespace Ombi.Store.Migrations
.HasPrincipalKey("EmbyId");
});
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
{
b.HasOne("Ombi.Store.Entities.LidarrArtistCache", "Artist")
.WithMany("Albums")
.HasForeignKey("ArtistId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")

View file

@ -7,6 +7,25 @@ namespace Ombi.Store.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LidarrAlbumCache",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ArtistId = table.Column<int>(nullable: false),
ForeignAlbumId = table.Column<string>(nullable: true),
TrackCount = table.Column<int>(nullable: false),
ReleaseDate = table.Column<DateTime>(nullable: false),
Monitored = table.Column<bool>(nullable: false),
Title = table.Column<string>(nullable: true),
PercentOfTracks = table.Column<decimal>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LidarrAlbumCache", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LidarrArtistCache",
columns: table => new
@ -22,35 +41,6 @@ namespace Ombi.Store.Migrations
{
table.PrimaryKey("PK_LidarrArtistCache", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LidarrAlbumCache",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ArtistId = table.Column<int>(nullable: false),
ForeignAlbumId = table.Column<string>(nullable: true),
TrackCount = table.Column<int>(nullable: false),
ReleaseDate = table.Column<DateTime>(nullable: false),
Monitored = table.Column<bool>(nullable: false),
Title = table.Column<string>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LidarrAlbumCache", x => x.Id);
table.ForeignKey(
name: "FK_LidarrAlbumCache_LidarrArtistCache_ArtistId",
column: x => x.ArtistId,
principalTable: "LidarrArtistCache",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_LidarrAlbumCache_ArtistId",
table: "LidarrAlbumCache",
column: "ArtistId");
}
protected override void Down(MigrationBuilder migrationBuilder)

View file

@ -255,6 +255,8 @@ namespace Ombi.Store.Migrations
b.Property<bool>("Monitored");
b.Property<decimal>("PercentOfTracks");
b.Property<DateTime>("ReleaseDate");
b.Property<string>("Title");
@ -263,8 +265,6 @@ namespace Ombi.Store.Migrations
b.HasKey("Id");
b.HasIndex("ArtistId");
b.ToTable("LidarrAlbumCache");
});
@ -963,14 +963,6 @@ namespace Ombi.Store.Migrations
.HasPrincipalKey("EmbyId");
});
modelBuilder.Entity("Ombi.Store.Entities.LidarrAlbumCache", b =>
{
b.HasOne("Ombi.Store.Entities.LidarrArtistCache", "Artist")
.WithMany("Albums")
.HasForeignKey("ArtistId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b =>
{
b.HasOne("Ombi.Store.Entities.OmbiUser", "User")