mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing the database context
This commit is contained in:
parent
0fa18bfa87
commit
733a844508
@ -15,7 +15,7 @@ namespace Kyoo.Models
|
||||
public string Overview { get; set; }
|
||||
public int? Year { get; set; }
|
||||
|
||||
[JsonIgnore] public string ImgPrimary { get; set; }
|
||||
[JsonIgnore] public string Poster { get; set; }
|
||||
public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
|
||||
|
||||
[JsonIgnore] public virtual Show Show { get; set; }
|
||||
@ -28,7 +28,7 @@ namespace Kyoo.Models
|
||||
string title,
|
||||
string overview,
|
||||
int? year,
|
||||
string imgPrimary,
|
||||
string poster,
|
||||
IEnumerable<MetadataID> externalIDs)
|
||||
{
|
||||
ShowID = showID;
|
||||
@ -36,7 +36,7 @@ namespace Kyoo.Models
|
||||
Title = title;
|
||||
Overview = overview;
|
||||
Year = year;
|
||||
ImgPrimary = imgPrimary;
|
||||
Poster = poster;
|
||||
ExternalIDs = externalIDs;
|
||||
}
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ namespace Kyoo.Controllers
|
||||
if (season?.Show?.Path == null)
|
||||
return default;
|
||||
|
||||
if (season.ImgPrimary != null)
|
||||
if (season.Poster != null)
|
||||
{
|
||||
string localPath = Path.Combine(season.Show.Path, $"season-{season.SeasonNumber}.jpg");
|
||||
if (alwaysDownload || !File.Exists(localPath))
|
||||
await DownloadImage(season.ImgPrimary, localPath, $"The poster of {season.Show.Title}'s season {season.SeasonNumber}");
|
||||
await DownloadImage(season.Poster, localPath, $"The poster of {season.Show.Title}'s season {season.SeasonNumber}");
|
||||
}
|
||||
return season;
|
||||
}
|
||||
|
@ -55,17 +55,21 @@ namespace Kyoo
|
||||
modelBuilder.HasPostgresEnum<ItemType>();
|
||||
modelBuilder.HasPostgresEnum<StreamType>();
|
||||
|
||||
modelBuilder.Entity<Library>()
|
||||
modelBuilder.Ignore<Library>();
|
||||
modelBuilder.Ignore<Collection>();
|
||||
modelBuilder.Ignore<Show>();
|
||||
modelBuilder.Ignore<Genre>();
|
||||
|
||||
modelBuilder.Entity<LibraryDE>()
|
||||
.Property(x => x.Paths)
|
||||
.HasColumnType("text[]")
|
||||
.Metadata.SetValueComparer(_stringArrayComparer);
|
||||
|
||||
modelBuilder.Entity<Show>()
|
||||
modelBuilder.Entity<ShowDE>()
|
||||
.Property(x => x.Aliases)
|
||||
.HasColumnType("text[]")
|
||||
.Metadata.SetValueComparer(_stringArrayComparer);
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<Track>()
|
||||
.Property(t => t.IsDefault)
|
||||
.ValueGeneratedNever();
|
||||
@ -77,16 +81,16 @@ namespace Kyoo
|
||||
modelBuilder.Entity<GenreLink>()
|
||||
.HasKey(x => new {x.ShowID, x.GenreID});
|
||||
|
||||
modelBuilder.Entity<Library>()
|
||||
modelBuilder.Entity<LibraryDE>()
|
||||
.Ignore(x => x.Shows)
|
||||
.Ignore(x => x.Collections)
|
||||
.Ignore(x => x.Providers);
|
||||
|
||||
modelBuilder.Entity<Collection>()
|
||||
modelBuilder.Entity<CollectionDE>()
|
||||
.Ignore(x => x.Shows)
|
||||
.Ignore(x => x.Libraries);
|
||||
|
||||
modelBuilder.Entity<Show>()
|
||||
modelBuilder.Entity<ShowDE>()
|
||||
.Ignore(x => x.Genres)
|
||||
.Ignore(x => x.Libraries)
|
||||
.Ignore(x => x.Collections);
|
||||
@ -97,12 +101,52 @@ namespace Kyoo
|
||||
.Ignore(x => x.Poster)
|
||||
.Ignore(x => x.ExternalIDs);
|
||||
|
||||
modelBuilder.Entity<Genre>()
|
||||
modelBuilder.Entity<GenreDE>()
|
||||
.Ignore(x => x.Shows);
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<LibraryLink>()
|
||||
.HasOne(x => x.Library as LibraryDE)
|
||||
.WithMany(x => x.Links);
|
||||
modelBuilder.Entity<LibraryLink>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.LibraryLinks);
|
||||
modelBuilder.Entity<LibraryLink>()
|
||||
.HasOne(x => x.Collection as CollectionDE)
|
||||
.WithMany(x => x.LibraryLinks);
|
||||
|
||||
modelBuilder.Entity<CollectionLink>()
|
||||
.HasOne(x => x.Collection as CollectionDE)
|
||||
.WithMany(x => x.Links);
|
||||
modelBuilder.Entity<CollectionLink>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.CollectionLinks);
|
||||
|
||||
modelBuilder.Entity<GenreLink>()
|
||||
.HasOne(x => x.Genre as GenreDE)
|
||||
.WithMany(x => x.Links);
|
||||
modelBuilder.Entity<GenreLink>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.GenreLinks);
|
||||
|
||||
modelBuilder.Entity<ProviderLink>()
|
||||
.HasOne(x => x.Library as LibraryDE)
|
||||
.WithMany(x => x.ProviderLinks);
|
||||
|
||||
modelBuilder.Entity<Season>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.Seasons);
|
||||
modelBuilder.Entity<Episode>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.Episodes);
|
||||
modelBuilder.Entity<PeopleRole>()
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.People);
|
||||
|
||||
|
||||
|
||||
modelBuilder.Entity<MetadataID>()
|
||||
.HasOne(x => x.Show)
|
||||
.HasOne(x => x.Show as ShowDE)
|
||||
.WithMany(x => x.ExternalIDs)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
modelBuilder.Entity<MetadataID>()
|
||||
@ -118,20 +162,27 @@ namespace Kyoo
|
||||
.WithMany(x => x.ExternalIDs)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<CollectionDE>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<GenreDE>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<LibraryDE>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<People>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<ProviderID>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<ShowDE>().Property(x => x.Slug).IsRequired();
|
||||
modelBuilder.Entity<Studio>().Property(x => x.Slug).IsRequired();
|
||||
|
||||
modelBuilder.Entity<Collection>()
|
||||
modelBuilder.Entity<CollectionDE>()
|
||||
.HasIndex(x => x.Slug)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<Genre>()
|
||||
modelBuilder.Entity<GenreDE>()
|
||||
.HasIndex(x => x.Slug)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<Library>()
|
||||
modelBuilder.Entity<LibraryDE>()
|
||||
.HasIndex(x => x.Slug)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<People>()
|
||||
.HasIndex(x => x.Slug)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<Show>()
|
||||
modelBuilder.Entity<ShowDE>()
|
||||
.HasIndex(x => x.Slug)
|
||||
.IsUnique();
|
||||
modelBuilder.Entity<Studio>()
|
||||
|
@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20200815231223_Initial")]
|
||||
[Migration("20200816150752_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -25,17 +25,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Collection", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -46,6 +42,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -53,9 +50,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Collection");
|
||||
b.ToTable("Collections");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Collection");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
@ -65,24 +62,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionDEID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.HasIndex("CollectionID", "ShowID")
|
||||
@ -141,21 +128,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Genre", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.GenreDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -163,9 +147,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Genre");
|
||||
b.ToTable("Genres");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Genre");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
@ -176,34 +160,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.Property<int>("GenreID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("GenreDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ShowID", "GenreID");
|
||||
|
||||
b.HasIndex("GenreDEID");
|
||||
|
||||
b.HasIndex("GenreID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.ToTable("GenreLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Library", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -211,6 +181,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -218,9 +189,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Library");
|
||||
b.ToTable("Libraries");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Library");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
@ -230,34 +201,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("LibraryDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionDEID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("LibraryDEID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.HasIndex("LibraryID", "CollectionID")
|
||||
@ -326,6 +282,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -378,6 +335,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -395,9 +353,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("LibraryDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -406,8 +361,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("LibraryDEID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
@ -422,10 +375,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
@ -448,7 +401,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Seasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -461,10 +414,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.Property<string>("Backdrop")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EndYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -484,6 +433,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("StartYear")
|
||||
@ -508,9 +458,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
b.HasIndex("StudioID");
|
||||
|
||||
b.ToTable("Show");
|
||||
b.ToTable("Shows");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Show");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Studio", b =>
|
||||
@ -524,6 +474,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -575,50 +526,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Tracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Collection");
|
||||
|
||||
b.HasDiscriminator().HasValue("CollectionDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Genre");
|
||||
|
||||
b.HasDiscriminator().HasValue("GenreDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Library");
|
||||
|
||||
b.HasDiscriminator().HasValue("LibraryDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Show");
|
||||
|
||||
b.HasDiscriminator().HasValue("ShowDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.CollectionDE", null)
|
||||
b.HasOne("Kyoo.Models.CollectionDE", "Collection")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("CollectionDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("CollectionLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -630,7 +545,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -639,22 +554,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.GenreDE", null)
|
||||
b.HasOne("Kyoo.Models.GenreDE", "Genre")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("GenreDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Genre", "Genre")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("GenreLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -662,30 +569,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.CollectionDE", null)
|
||||
b.HasOne("Kyoo.Models.CollectionDE", "Collection")
|
||||
.WithMany("LibraryLinks")
|
||||
.HasForeignKey("CollectionDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.LibraryDE", null)
|
||||
b.HasOne("Kyoo.Models.LibraryDE", "Library")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("LibraryDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany()
|
||||
.HasForeignKey("LibraryID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("LibraryLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
@ -712,7 +607,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasForeignKey("SeasonID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@ -726,7 +621,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("People")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -735,12 +630,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.LibraryDE", null)
|
||||
b.HasOne("Kyoo.Models.LibraryDE", "Library")
|
||||
.WithMany("ProviderLinks")
|
||||
.HasForeignKey("LibraryDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany()
|
||||
.HasForeignKey("LibraryID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
@ -752,17 +643,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Studio", "Studio")
|
||||
.WithMany("Shows")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudioID");
|
||||
});
|
||||
|
@ -14,51 +14,48 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.Annotation("Npgsql:Enum:stream_type", "unknow,video,audio,subtitle");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Collection",
|
||||
name: "Collections",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Poster = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
Discriminator = table.Column<string>(nullable: false)
|
||||
Overview = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Collection", x => x.ID);
|
||||
table.PrimaryKey("PK_Collections", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genre",
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Discriminator = table.Column<string>(nullable: false)
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genre", x => x.ID);
|
||||
table.PrimaryKey("PK_Genres", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Library",
|
||||
name: "Libraries",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Paths = table.Column<string[]>(type: "text[]", nullable: true),
|
||||
Discriminator = table.Column<string>(nullable: false)
|
||||
Paths = table.Column<string[]>(type: "text[]", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Library", x => x.ID);
|
||||
table.PrimaryKey("PK_Libraries", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@ -67,7 +64,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Poster = table.Column<string>(nullable: true)
|
||||
},
|
||||
@ -82,7 +79,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Logo = table.Column<string>(nullable: true)
|
||||
},
|
||||
@ -97,7 +94,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
@ -112,22 +109,15 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProviderID = table.Column<int>(nullable: false),
|
||||
LibraryID = table.Column<int>(nullable: true),
|
||||
LibraryDEID = table.Column<int>(nullable: true)
|
||||
LibraryID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProviderLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProviderLinks_Library_LibraryDEID",
|
||||
column: x => x.LibraryDEID,
|
||||
principalTable: "Library",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProviderLinks_Library_LibraryID",
|
||||
name: "FK_ProviderLinks_Libraries_LibraryID",
|
||||
column: x => x.LibraryID,
|
||||
principalTable: "Library",
|
||||
principalTable: "Libraries",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
@ -139,12 +129,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Show",
|
||||
name: "Shows",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Slug = table.Column<string>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Aliases = table.Column<string[]>(type: "text[]", nullable: true),
|
||||
Path = table.Column<string>(nullable: true),
|
||||
@ -157,14 +147,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
Logo = table.Column<string>(nullable: true),
|
||||
Backdrop = table.Column<string>(nullable: true),
|
||||
IsMovie = table.Column<bool>(nullable: false),
|
||||
StudioID = table.Column<int>(nullable: true),
|
||||
Discriminator = table.Column<string>(nullable: false)
|
||||
StudioID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Show", x => x.ID);
|
||||
table.PrimaryKey("PK_Shows", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Show_Studios_StudioID",
|
||||
name: "FK_Shows_Studios_StudioID",
|
||||
column: x => x.StudioID,
|
||||
principalTable: "Studios",
|
||||
principalColumn: "ID",
|
||||
@ -178,35 +167,21 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CollectionID = table.Column<int>(nullable: true),
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
CollectionDEID = table.Column<int>(nullable: true),
|
||||
ShowDEID = table.Column<int>(nullable: true)
|
||||
ShowID = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CollectionLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Collection_CollectionDEID",
|
||||
column: x => x.CollectionDEID,
|
||||
principalTable: "Collection",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Collection_CollectionID",
|
||||
name: "FK_CollectionLinks_Collections_CollectionID",
|
||||
column: x => x.CollectionID,
|
||||
principalTable: "Collection",
|
||||
principalTable: "Collections",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Show_ShowDEID",
|
||||
column: x => x.ShowDEID,
|
||||
principalTable: "Show",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Show_ShowID",
|
||||
name: "FK_CollectionLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -216,35 +191,21 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
columns: table => new
|
||||
{
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
GenreID = table.Column<int>(nullable: false),
|
||||
GenreDEID = table.Column<int>(nullable: true),
|
||||
ShowDEID = table.Column<int>(nullable: true)
|
||||
GenreID = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GenreLinks", x => new { x.ShowID, x.GenreID });
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Genre_GenreDEID",
|
||||
column: x => x.GenreDEID,
|
||||
principalTable: "Genre",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Genre_GenreID",
|
||||
name: "FK_GenreLinks_Genres_GenreID",
|
||||
column: x => x.GenreID,
|
||||
principalTable: "Genre",
|
||||
principalTable: "Genres",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Show_ShowDEID",
|
||||
column: x => x.ShowDEID,
|
||||
principalTable: "Show",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Show_ShowID",
|
||||
name: "FK_GenreLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -257,48 +218,27 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
LibraryID = table.Column<int>(nullable: false),
|
||||
ShowID = table.Column<int>(nullable: true),
|
||||
CollectionID = table.Column<int>(nullable: true),
|
||||
CollectionDEID = table.Column<int>(nullable: true),
|
||||
LibraryDEID = table.Column<int>(nullable: true),
|
||||
ShowDEID = table.Column<int>(nullable: true)
|
||||
CollectionID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LibraryLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Collection_CollectionDEID",
|
||||
column: x => x.CollectionDEID,
|
||||
principalTable: "Collection",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Collection_CollectionID",
|
||||
name: "FK_LibraryLinks_Collections_CollectionID",
|
||||
column: x => x.CollectionID,
|
||||
principalTable: "Collection",
|
||||
principalTable: "Collections",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Library_LibraryDEID",
|
||||
column: x => x.LibraryDEID,
|
||||
principalTable: "Library",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Library_LibraryID",
|
||||
name: "FK_LibraryLinks_Libraries_LibraryID",
|
||||
column: x => x.LibraryID,
|
||||
principalTable: "Library",
|
||||
principalTable: "Libraries",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Show_ShowDEID",
|
||||
column: x => x.ShowDEID,
|
||||
principalTable: "Show",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Show_ShowID",
|
||||
name: "FK_LibraryLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
@ -324,9 +264,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PeopleRoles_Show_ShowID",
|
||||
name: "FK_PeopleRoles_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -342,15 +282,15 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
Year = table.Column<int>(nullable: true),
|
||||
ImgPrimary = table.Column<string>(nullable: true)
|
||||
Poster = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Seasons", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Seasons_Show_ShowID",
|
||||
name: "FK_Seasons_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -383,9 +323,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Episodes_Show_ShowID",
|
||||
name: "FK_Episodes_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -432,9 +372,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_MetadataIds_Show_ShowID",
|
||||
name: "FK_MetadataIds_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Show",
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
@ -466,22 +406,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Collection_Slug",
|
||||
table: "Collection",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionLinks_CollectionDEID",
|
||||
table: "CollectionLinks",
|
||||
column: "CollectionDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionLinks_ShowDEID",
|
||||
table: "CollectionLinks",
|
||||
column: "ShowDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionLinks_ShowID",
|
||||
table: "CollectionLinks",
|
||||
@ -493,6 +417,12 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
columns: new[] { "CollectionID", "ShowID" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Collections_Slug",
|
||||
table: "Collections",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Episodes_SeasonID",
|
||||
table: "Episodes",
|
||||
@ -504,53 +434,28 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
columns: new[] { "ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genre_Slug",
|
||||
table: "Genre",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GenreLinks_GenreDEID",
|
||||
table: "GenreLinks",
|
||||
column: "GenreDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GenreLinks_GenreID",
|
||||
table: "GenreLinks",
|
||||
column: "GenreID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GenreLinks_ShowDEID",
|
||||
table: "GenreLinks",
|
||||
column: "ShowDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Library_Slug",
|
||||
table: "Library",
|
||||
name: "IX_Genres_Slug",
|
||||
table: "Genres",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_CollectionDEID",
|
||||
table: "LibraryLinks",
|
||||
column: "CollectionDEID");
|
||||
name: "IX_Libraries_Slug",
|
||||
table: "Libraries",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_CollectionID",
|
||||
table: "LibraryLinks",
|
||||
column: "CollectionID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_LibraryDEID",
|
||||
table: "LibraryLinks",
|
||||
column: "LibraryDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_ShowDEID",
|
||||
table: "LibraryLinks",
|
||||
column: "ShowDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_ShowID",
|
||||
table: "LibraryLinks",
|
||||
@ -609,11 +514,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
table: "PeopleRoles",
|
||||
column: "ShowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProviderLinks_LibraryDEID",
|
||||
table: "ProviderLinks",
|
||||
column: "LibraryDEID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ProviderLinks_LibraryID",
|
||||
table: "ProviderLinks",
|
||||
@ -637,14 +537,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Show_Slug",
|
||||
table: "Show",
|
||||
name: "IX_Shows_Slug",
|
||||
table: "Shows",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Show_StudioID",
|
||||
table: "Show",
|
||||
name: "IX_Shows_StudioID",
|
||||
table: "Shows",
|
||||
column: "StudioID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
@ -683,16 +583,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
name: "Tracks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genre");
|
||||
name: "Genres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Collection");
|
||||
name: "Collections");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "People");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Library");
|
||||
name: "Libraries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Providers");
|
||||
@ -704,7 +604,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
name: "Seasons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Show");
|
||||
name: "Shows");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Studios");
|
@ -23,17 +23,13 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Collection", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -44,6 +40,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -51,9 +48,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Collection");
|
||||
b.ToTable("Collections");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Collection");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
@ -63,24 +60,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionDEID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.HasIndex("CollectionID", "ShowID")
|
||||
@ -139,21 +126,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Genre", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.GenreDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -161,9 +145,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Genre");
|
||||
b.ToTable("Genres");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Genre");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
@ -174,34 +158,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.Property<int>("GenreID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("GenreDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ShowID", "GenreID");
|
||||
|
||||
b.HasIndex("GenreDEID");
|
||||
|
||||
b.HasIndex("GenreID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.ToTable("GenreLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Library", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -209,6 +179,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -216,9 +187,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Library");
|
||||
b.ToTable("Libraries");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Library");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
@ -228,34 +199,19 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("LibraryDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionDEID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("LibraryDEID");
|
||||
|
||||
b.HasIndex("ShowDEID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.HasIndex("LibraryID", "CollectionID")
|
||||
@ -324,6 +280,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -376,6 +333,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -393,9 +351,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("LibraryDEID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -404,8 +359,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("LibraryDEID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
@ -420,10 +373,10 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
@ -446,7 +399,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Seasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
@ -459,10 +412,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.Property<string>("Backdrop")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EndYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
@ -482,6 +431,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("StartYear")
|
||||
@ -506,9 +456,9 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
b.HasIndex("StudioID");
|
||||
|
||||
b.ToTable("Show");
|
||||
b.ToTable("Shows");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Show");
|
||||
b.HasDiscriminator();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Studio", b =>
|
||||
@ -522,6 +472,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
@ -573,50 +524,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
b.ToTable("Tracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Collection");
|
||||
|
||||
b.HasDiscriminator().HasValue("CollectionDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Genre");
|
||||
|
||||
b.HasDiscriminator().HasValue("GenreDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Library");
|
||||
|
||||
b.HasDiscriminator().HasValue("LibraryDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.HasBaseType("Kyoo.Models.Show");
|
||||
|
||||
b.HasDiscriminator().HasValue("ShowDE");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.CollectionDE", null)
|
||||
b.HasOne("Kyoo.Models.CollectionDE", "Collection")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("CollectionDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("CollectionLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -628,7 +543,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -637,22 +552,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.GenreDE", null)
|
||||
b.HasOne("Kyoo.Models.GenreDE", "Genre")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("GenreDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Genre", "Genre")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("GenreLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
@ -660,30 +567,18 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.CollectionDE", null)
|
||||
b.HasOne("Kyoo.Models.CollectionDE", "Collection")
|
||||
.WithMany("LibraryLinks")
|
||||
.HasForeignKey("CollectionDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.LibraryDE", null)
|
||||
b.HasOne("Kyoo.Models.LibraryDE", "Library")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("LibraryDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany()
|
||||
.HasForeignKey("LibraryID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.ShowDE", null)
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("LibraryLinks")
|
||||
.HasForeignKey("ShowDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
@ -710,7 +605,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.HasForeignKey("SeasonID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
@ -724,7 +619,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("People")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
@ -733,12 +628,8 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.LibraryDE", null)
|
||||
b.HasOne("Kyoo.Models.LibraryDE", "Library")
|
||||
.WithMany("ProviderLinks")
|
||||
.HasForeignKey("LibraryDEID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany()
|
||||
.HasForeignKey("LibraryID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
@ -750,17 +641,17 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
b.HasOne("Kyoo.Models.ShowDE", "Show")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
modelBuilder.Entity("Kyoo.Models.ShowDE", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Studio", "Studio")
|
||||
.WithMany("Shows")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudioID");
|
||||
});
|
||||
|
||||
|
@ -1,19 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kyoo.Models.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kyoo.Models
|
||||
{
|
||||
public class CollectionDE : Collection
|
||||
{
|
||||
[NotMergable] public virtual IEnumerable<CollectionLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<CollectionLink> Links { get; set; }
|
||||
public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Select(x => x.Show);
|
||||
set => Links = value?.Select(x => new CollectionLink(this, x));
|
||||
}
|
||||
|
||||
[NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
public override IEnumerable<Library> Libraries
|
||||
{
|
||||
get => LibraryLinks?.Select(x => x.Library);
|
||||
|
@ -1,14 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kyoo.Models.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kyoo.Models
|
||||
{
|
||||
public class GenreDE : Genre
|
||||
{
|
||||
[NotMergable] public virtual IEnumerable<GenreLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<GenreLink> Links { get; set; }
|
||||
|
||||
[NotMergable] public override IEnumerable<Show> Shows
|
||||
[JsonIgnore] [NotMergable] public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Select(x => x.Show);
|
||||
set => Links = value?.Select(x => new GenreLink(x, this));
|
||||
|
@ -1,19 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kyoo.Models.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kyoo.Models
|
||||
{
|
||||
public class LibraryDE : Library
|
||||
{
|
||||
[NotMergable] public virtual IEnumerable<ProviderLink> ProviderLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<ProviderLink> ProviderLinks { get; set; }
|
||||
public override IEnumerable<ProviderID> Providers
|
||||
{
|
||||
get => ProviderLinks?.Select(x => x.Provider);
|
||||
set => ProviderLinks = value?.Select(x => new ProviderLink(x, this)).ToList();
|
||||
}
|
||||
|
||||
[NotMergable] public virtual IEnumerable<LibraryLink> Links { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> Links { get; set; }
|
||||
public override IEnumerable<Show> Shows
|
||||
{
|
||||
get => Links?.Where(x => x.Show != null).Select(x => x.Show);
|
||||
|
@ -1,26 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kyoo.Models.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
// TODO Remove every [JsonIgnore] tag from here once the serializer knows which property should be serialized.
|
||||
|
||||
namespace Kyoo.Models
|
||||
{
|
||||
public class ShowDE : Show
|
||||
{
|
||||
[NotMergable] public virtual IEnumerable<GenreLink> GenreLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<GenreLink> GenreLinks { get; set; }
|
||||
public override IEnumerable<Genre> Genres
|
||||
{
|
||||
get => GenreLinks?.Select(x => x.Genre);
|
||||
set => GenreLinks = value?.Select(x => new GenreLink(this, x)).ToList();
|
||||
}
|
||||
|
||||
[NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<LibraryLink> LibraryLinks { get; set; }
|
||||
public override IEnumerable<Library> Libraries
|
||||
{
|
||||
get => LibraryLinks?.Select(x => x.Library);
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this));
|
||||
}
|
||||
|
||||
[NotMergable] public virtual IEnumerable<CollectionLink> CollectionLinks { get; set; }
|
||||
[JsonIgnore] [NotMergable] public virtual IEnumerable<CollectionLink> CollectionLinks { get; set; }
|
||||
|
||||
public override IEnumerable<Collection> Collections
|
||||
{
|
||||
|
@ -46,9 +46,9 @@ namespace Kyoo
|
||||
services.AddDbContext<DatabaseContext>(options =>
|
||||
{
|
||||
options.UseLazyLoadingProxies()
|
||||
.UseNpgsql(_configuration.GetConnectionString("Database"));
|
||||
// .EnableSensitiveDataLogging()
|
||||
// .UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
||||
.UseNpgsql(_configuration.GetConnectionString("Database"))
|
||||
.EnableSensitiveDataLogging()
|
||||
.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
||||
}, ServiceLifetime.Transient);
|
||||
|
||||
services.AddDbContext<IdentityDatabase>(options =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user