mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-04 03:27:14 -05:00 
			
		
		
		
	Finishing the rework of providers in the db
This commit is contained in:
		
							parent
							
								
									9580056df1
								
							
						
					
					
						commit
						e54b86b16a
					
				@ -11,7 +11,7 @@
 | 
				
			|||||||
		<Company>SDG</Company>
 | 
							<Company>SDG</Company>
 | 
				
			||||||
		<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
 | 
							<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
 | 
				
			||||||
		<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
 | 
							<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
 | 
				
			||||||
		<PackageVersion>1.0.17</PackageVersion>
 | 
							<PackageVersion>1.0.18</PackageVersion>
 | 
				
			||||||
	</PropertyGroup>
 | 
						</PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	<ItemGroup>
 | 
						<ItemGroup>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
using Newtonsoft.Json;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using Newtonsoft.Json;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Kyoo.Models
 | 
					namespace Kyoo.Models
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -8,11 +9,11 @@ namespace Kyoo.Models
 | 
				
			|||||||
		public string Slug { get; set; }
 | 
							public string Slug { get; set; }
 | 
				
			||||||
		public string Name { get; set; }
 | 
							public string Name { get; set; }
 | 
				
			||||||
		public string[] Paths { get; set; }
 | 
							public string[] Paths { get; set; }
 | 
				
			||||||
		public ProviderID[] Providers { get; set; }
 | 
							public virtual IEnumerable<ProviderLink> Providers { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Library()  { }
 | 
							public Library()  { }
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public Library(string slug, string name, string[] paths, ProviderID[] providers)
 | 
							public Library(string slug, string name, string[] paths, IEnumerable<ProviderLink> providers)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Slug = slug;
 | 
								Slug = slug;
 | 
				
			||||||
			Name = name;
 | 
								Name = name;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								Kyoo.Common/Models/ProviderLink.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Kyoo.Common/Models/ProviderLink.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					namespace Kyoo.Models
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class ProviderLink
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public long ID { get; set; }
 | 
				
			||||||
 | 
							public long ProviderID { get; set; }
 | 
				
			||||||
 | 
							public virtual ProviderID Provider { get; set; }
 | 
				
			||||||
 | 
							public long? ShowID { get; set; }
 | 
				
			||||||
 | 
							public virtual Show Show { get; set; }
 | 
				
			||||||
 | 
							public long? LibraryID { get; set; }
 | 
				
			||||||
 | 
							public virtual Library Library { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public string Name => Provider.Name;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							public ProviderLink() { }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -24,7 +24,7 @@ namespace Kyoo.Models
 | 
				
			|||||||
		[JsonIgnore] public string ImgLogo { get; set; }
 | 
							[JsonIgnore] public string ImgLogo { get; set; }
 | 
				
			||||||
		[JsonIgnore] public string ImgBackdrop { get; set; }
 | 
							[JsonIgnore] public string ImgBackdrop { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public IEnumerable<MetadataID> ExternalIDs { get; set; }
 | 
							public virtual IEnumerable<MetadataID> ExternalIDs { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public bool IsMovie { get; set; }
 | 
							public bool IsMovie { get; set; }
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
				
			|||||||
@ -20,10 +20,10 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			T ret = new T();
 | 
								T ret = new T();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			IEnumerable<IMetadataProvider> providers = library?.Providers != null
 | 
								IEnumerable<IMetadataProvider> providers = library?.Providers
 | 
				
			||||||
				? _providers.Where(x => library.Providers.Contains(x.Provider))
 | 
					                   .Select(x => _providers.FirstOrDefault(y => y.Provider.Name == x.Name))
 | 
				
			||||||
					.OrderBy(provider => Array.IndexOf(library.Providers, provider.Provider))
 | 
					                   .Where(x => x != null)
 | 
				
			||||||
				: _providers;
 | 
					               ?? _providers;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			foreach (IMetadataProvider provider in providers)
 | 
								foreach (IMetadataProvider provider in providers)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
@ -41,10 +41,10 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			List<T> ret = new List<T>();
 | 
								List<T> ret = new List<T>();
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			IEnumerable<IMetadataProvider> providers = library?.Providers != null
 | 
								IEnumerable<IMetadataProvider> providers = library?.Providers
 | 
				
			||||||
				? _providers.Where(x => library.Providers.Contains(x.Provider))
 | 
										.Select(x => _providers.FirstOrDefault(y => y.Provider.Name == x.Name))
 | 
				
			||||||
					.OrderBy(provider => Array.IndexOf(library.Providers, provider.Provider))
 | 
										.Where(x => x != null)
 | 
				
			||||||
				: _providers;
 | 
								    ?? _providers;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			foreach (IMetadataProvider provider in providers)
 | 
								foreach (IMetadataProvider provider in providers)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
				
			|||||||
@ -85,6 +85,7 @@ namespace Kyoo
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		// This is used because EF doesn't support Many-To-Many relationships so for now we need to override the getter/setters to store this.
 | 
							// This is used because EF doesn't support Many-To-Many relationships so for now we need to override the getter/setters to store this.
 | 
				
			||||||
		public DbSet<GenreLink> GenreLinks { get; set; }
 | 
							public DbSet<GenreLink> GenreLinks { get; set; }
 | 
				
			||||||
 | 
							public DbSet<ProviderLink> ProviderLinks { get; set; }
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		private ValueConverter<string[], string> stringArrayConverter = new ValueConverter<string[], string>(
 | 
							private ValueConverter<string[], string> stringArrayConverter = new ValueConverter<string[], string>(
 | 
				
			||||||
@ -101,7 +102,6 @@ namespace Kyoo
 | 
				
			|||||||
			base.OnModelCreating(modelBuilder);
 | 
								base.OnModelCreating(modelBuilder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			modelBuilder.Entity<Library>().Property(e => e.Paths).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
 | 
								modelBuilder.Entity<Library>().Property(e => e.Paths).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
 | 
				
			||||||
			modelBuilder.Entity<Library>().Property(e => e.Providers).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
 | 
					 | 
				
			||||||
			modelBuilder.Entity<Show>().Property(e => e.Aliases).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
 | 
								modelBuilder.Entity<Show>().Property(e => e.Aliases).HasConversion(stringArrayConverter).Metadata.SetValueComparer(stringArrayComparer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			modelBuilder.Entity<Track>()
 | 
								modelBuilder.Entity<Track>()
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
 | 
				
			|||||||
namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
					namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    [DbContext(typeof(DatabaseContext))]
 | 
					    [DbContext(typeof(DatabaseContext))]
 | 
				
			||||||
    [Migration("20200414223325_Initial")]
 | 
					    [Migration("20200423203356_Initial")]
 | 
				
			||||||
    partial class Initial
 | 
					    partial class Initial
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
					        protected override void BuildTargetModel(ModelBuilder modelBuilder)
 | 
				
			||||||
@ -166,9 +166,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.Property<string>("Paths")
 | 
					                    b.Property<string>("Paths")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<string>("Providers")
 | 
					 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Slug")
 | 
					                    b.Property<string>("Slug")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -206,6 +203,33 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.ToTable("LibraryLinks");
 | 
					                    b.ToTable("LibraryLinks");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("DataID")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Link")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ProviderID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ShowID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("MetadataIds");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.People", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.People", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.Property<string>("Slug")
 | 
					                    b.Property<string>("Slug")
 | 
				
			||||||
@ -255,6 +279,49 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.ToTable("PeopleLinks");
 | 
					                    b.ToTable("PeopleLinks");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Logo")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Name")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("ProviderIds");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long?>("LibraryID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ProviderID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long?>("ShowID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("LibraryID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("ProviderLinks");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.Property<long>("ID")
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
@ -301,9 +368,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.Property<long?>("EndYear")
 | 
					                    b.Property<long?>("EndYear")
 | 
				
			||||||
                        .HasColumnType("INTEGER");
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<string>("ExternalIDs")
 | 
					 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("ImgBackdrop")
 | 
					                    b.Property<string>("ImgBackdrop")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -471,6 +535,21 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        .HasForeignKey("ShowID");
 | 
					                        .HasForeignKey("ShowID");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.ProviderID", "Provider")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ProviderID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
 | 
					                        .WithMany("ExternalIDs")
 | 
				
			||||||
 | 
					                        .HasForeignKey("ShowID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.HasOne("Kyoo.Models.People", "People")
 | 
					                    b.HasOne("Kyoo.Models.People", "People")
 | 
				
			||||||
@ -484,6 +563,23 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        .IsRequired();
 | 
					                        .IsRequired();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Library", "Library")
 | 
				
			||||||
 | 
					                        .WithMany("Providers")
 | 
				
			||||||
 | 
					                        .HasForeignKey("LibraryID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.ProviderID", "Provider")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ProviderID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ShowID");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
@ -46,8 +46,7 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        .Annotation("Sqlite:Autoincrement", true),
 | 
					                        .Annotation("Sqlite:Autoincrement", true),
 | 
				
			||||||
                    Slug = table.Column<string>(nullable: true),
 | 
					                    Slug = table.Column<string>(nullable: true),
 | 
				
			||||||
                    Name = table.Column<string>(nullable: true),
 | 
					                    Name = table.Column<string>(nullable: true),
 | 
				
			||||||
                    Paths = table.Column<string>(nullable: true),
 | 
					                    Paths = table.Column<string>(nullable: true)
 | 
				
			||||||
                    Providers = table.Column<string>(nullable: true)
 | 
					 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                constraints: table =>
 | 
					                constraints: table =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -68,6 +67,20 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    table.PrimaryKey("PK_Peoples", x => x.Slug);
 | 
					                    table.PrimaryKey("PK_Peoples", x => x.Slug);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
 | 
					                name: "ProviderIds",
 | 
				
			||||||
 | 
					                columns: table => new
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ID = table.Column<long>(nullable: false)
 | 
				
			||||||
 | 
					                        .Annotation("Sqlite:Autoincrement", true),
 | 
				
			||||||
 | 
					                    Name = table.Column<string>(nullable: true),
 | 
				
			||||||
 | 
					                    Logo = table.Column<string>(nullable: true)
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                constraints: table =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    table.PrimaryKey("PK_ProviderIds", x => x.ID);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
                name: "Studios",
 | 
					                name: "Studios",
 | 
				
			||||||
                columns: table => new
 | 
					                columns: table => new
 | 
				
			||||||
@ -101,7 +114,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    ImgThumb = table.Column<string>(nullable: true),
 | 
					                    ImgThumb = table.Column<string>(nullable: true),
 | 
				
			||||||
                    ImgLogo = table.Column<string>(nullable: true),
 | 
					                    ImgLogo = table.Column<string>(nullable: true),
 | 
				
			||||||
                    ImgBackdrop = table.Column<string>(nullable: true),
 | 
					                    ImgBackdrop = table.Column<string>(nullable: true),
 | 
				
			||||||
                    ExternalIDs = table.Column<string>(nullable: true),
 | 
					 | 
				
			||||||
                    IsMovie = table.Column<bool>(nullable: false),
 | 
					                    IsMovie = table.Column<bool>(nullable: false),
 | 
				
			||||||
                    StudioID = table.Column<long>(nullable: true)
 | 
					                    StudioID = table.Column<long>(nullable: true)
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
@ -199,6 +211,34 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        onDelete: ReferentialAction.Restrict);
 | 
					                        onDelete: ReferentialAction.Restrict);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
 | 
					                name: "MetadataIds",
 | 
				
			||||||
 | 
					                columns: table => new
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ID = table.Column<long>(nullable: false)
 | 
				
			||||||
 | 
					                        .Annotation("Sqlite:Autoincrement", true),
 | 
				
			||||||
 | 
					                    ShowID = table.Column<long>(nullable: false),
 | 
				
			||||||
 | 
					                    ProviderID = table.Column<long>(nullable: false),
 | 
				
			||||||
 | 
					                    DataID = table.Column<string>(nullable: true),
 | 
				
			||||||
 | 
					                    Link = table.Column<string>(nullable: true)
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                constraints: table =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    table.PrimaryKey("PK_MetadataIds", x => x.ID);
 | 
				
			||||||
 | 
					                    table.ForeignKey(
 | 
				
			||||||
 | 
					                        name: "FK_MetadataIds_ProviderIds_ProviderID",
 | 
				
			||||||
 | 
					                        column: x => x.ProviderID,
 | 
				
			||||||
 | 
					                        principalTable: "ProviderIds",
 | 
				
			||||||
 | 
					                        principalColumn: "ID",
 | 
				
			||||||
 | 
					                        onDelete: ReferentialAction.Cascade);
 | 
				
			||||||
 | 
					                    table.ForeignKey(
 | 
				
			||||||
 | 
					                        name: "FK_MetadataIds_Shows_ShowID",
 | 
				
			||||||
 | 
					                        column: x => x.ShowID,
 | 
				
			||||||
 | 
					                        principalTable: "Shows",
 | 
				
			||||||
 | 
					                        principalColumn: "ID",
 | 
				
			||||||
 | 
					                        onDelete: ReferentialAction.Cascade);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
                name: "PeopleLinks",
 | 
					                name: "PeopleLinks",
 | 
				
			||||||
                columns: table => new
 | 
					                columns: table => new
 | 
				
			||||||
@ -227,6 +267,39 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        onDelete: ReferentialAction.Cascade);
 | 
					                        onDelete: ReferentialAction.Cascade);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
 | 
					                name: "ProviderLinks",
 | 
				
			||||||
 | 
					                columns: table => new
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ID = table.Column<long>(nullable: false)
 | 
				
			||||||
 | 
					                        .Annotation("Sqlite:Autoincrement", true),
 | 
				
			||||||
 | 
					                    ProviderID = table.Column<long>(nullable: false),
 | 
				
			||||||
 | 
					                    ShowID = table.Column<long>(nullable: true),
 | 
				
			||||||
 | 
					                    LibraryID = table.Column<long>(nullable: true)
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                constraints: table =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    table.PrimaryKey("PK_ProviderLinks", x => x.ID);
 | 
				
			||||||
 | 
					                    table.ForeignKey(
 | 
				
			||||||
 | 
					                        name: "FK_ProviderLinks_Libraries_LibraryID",
 | 
				
			||||||
 | 
					                        column: x => x.LibraryID,
 | 
				
			||||||
 | 
					                        principalTable: "Libraries",
 | 
				
			||||||
 | 
					                        principalColumn: "ID",
 | 
				
			||||||
 | 
					                        onDelete: ReferentialAction.Restrict);
 | 
				
			||||||
 | 
					                    table.ForeignKey(
 | 
				
			||||||
 | 
					                        name: "FK_ProviderLinks_ProviderIds_ProviderID",
 | 
				
			||||||
 | 
					                        column: x => x.ProviderID,
 | 
				
			||||||
 | 
					                        principalTable: "ProviderIds",
 | 
				
			||||||
 | 
					                        principalColumn: "ID",
 | 
				
			||||||
 | 
					                        onDelete: ReferentialAction.Cascade);
 | 
				
			||||||
 | 
					                    table.ForeignKey(
 | 
				
			||||||
 | 
					                        name: "FK_ProviderLinks_Shows_ShowID",
 | 
				
			||||||
 | 
					                        column: x => x.ShowID,
 | 
				
			||||||
 | 
					                        principalTable: "Shows",
 | 
				
			||||||
 | 
					                        principalColumn: "ID",
 | 
				
			||||||
 | 
					                        onDelete: ReferentialAction.Restrict);
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.CreateTable(
 | 
					            migrationBuilder.CreateTable(
 | 
				
			||||||
                name: "Seasons",
 | 
					                name: "Seasons",
 | 
				
			||||||
                columns: table => new
 | 
					                columns: table => new
 | 
				
			||||||
@ -373,6 +446,16 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                table: "LibraryLinks",
 | 
					                table: "LibraryLinks",
 | 
				
			||||||
                column: "ShowID");
 | 
					                column: "ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
 | 
					                name: "IX_MetadataIds_ProviderID",
 | 
				
			||||||
 | 
					                table: "MetadataIds",
 | 
				
			||||||
 | 
					                column: "ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
 | 
					                name: "IX_MetadataIds_ShowID",
 | 
				
			||||||
 | 
					                table: "MetadataIds",
 | 
				
			||||||
 | 
					                column: "ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.CreateIndex(
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
                name: "IX_PeopleLinks_PeopleID",
 | 
					                name: "IX_PeopleLinks_PeopleID",
 | 
				
			||||||
                table: "PeopleLinks",
 | 
					                table: "PeopleLinks",
 | 
				
			||||||
@ -389,6 +472,21 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                column: "Slug",
 | 
					                column: "Slug",
 | 
				
			||||||
                unique: true);
 | 
					                unique: true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
 | 
					                name: "IX_ProviderLinks_LibraryID",
 | 
				
			||||||
 | 
					                table: "ProviderLinks",
 | 
				
			||||||
 | 
					                column: "LibraryID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
 | 
					                name: "IX_ProviderLinks_ProviderID",
 | 
				
			||||||
 | 
					                table: "ProviderLinks",
 | 
				
			||||||
 | 
					                column: "ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
 | 
					                name: "IX_ProviderLinks_ShowID",
 | 
				
			||||||
 | 
					                table: "ProviderLinks",
 | 
				
			||||||
 | 
					                column: "ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.CreateIndex(
 | 
					            migrationBuilder.CreateIndex(
 | 
				
			||||||
                name: "IX_Seasons_ShowID",
 | 
					                name: "IX_Seasons_ShowID",
 | 
				
			||||||
                table: "Seasons",
 | 
					                table: "Seasons",
 | 
				
			||||||
@ -428,9 +526,15 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "LibraryLinks");
 | 
					                name: "LibraryLinks");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
 | 
					                name: "MetadataIds");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "PeopleLinks");
 | 
					                name: "PeopleLinks");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
 | 
					                name: "ProviderLinks");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "Tracks");
 | 
					                name: "Tracks");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -440,11 +544,14 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "Collections");
 | 
					                name: "Collections");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
 | 
					                name: "Peoples");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "Libraries");
 | 
					                name: "Libraries");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "Peoples");
 | 
					                name: "ProviderIds");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            migrationBuilder.DropTable(
 | 
					            migrationBuilder.DropTable(
 | 
				
			||||||
                name: "Episodes");
 | 
					                name: "Episodes");
 | 
				
			||||||
@ -164,9 +164,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.Property<string>("Paths")
 | 
					                    b.Property<string>("Paths")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<string>("Providers")
 | 
					 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("Slug")
 | 
					                    b.Property<string>("Slug")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -204,6 +201,33 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.ToTable("LibraryLinks");
 | 
					                    b.ToTable("LibraryLinks");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("DataID")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Link")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ProviderID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ShowID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("MetadataIds");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.People", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.People", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.Property<string>("Slug")
 | 
					                    b.Property<string>("Slug")
 | 
				
			||||||
@ -253,6 +277,49 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.ToTable("PeopleLinks");
 | 
					                    b.ToTable("PeopleLinks");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Logo")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<string>("Name")
 | 
				
			||||||
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("ProviderIds");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
 | 
					                        .ValueGeneratedOnAdd()
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long?>("LibraryID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long>("ProviderID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.Property<long?>("ShowID")
 | 
				
			||||||
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasKey("ID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("LibraryID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ProviderID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasIndex("ShowID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.ToTable("ProviderLinks");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.Property<long>("ID")
 | 
					                    b.Property<long>("ID")
 | 
				
			||||||
@ -299,9 +366,6 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                    b.Property<long?>("EndYear")
 | 
					                    b.Property<long?>("EndYear")
 | 
				
			||||||
                        .HasColumnType("INTEGER");
 | 
					                        .HasColumnType("INTEGER");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    b.Property<string>("ExternalIDs")
 | 
					 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    b.Property<string>("ImgBackdrop")
 | 
					                    b.Property<string>("ImgBackdrop")
 | 
				
			||||||
                        .HasColumnType("TEXT");
 | 
					                        .HasColumnType("TEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -469,6 +533,21 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        .HasForeignKey("ShowID");
 | 
					                        .HasForeignKey("ShowID");
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.ProviderID", "Provider")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ProviderID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
 | 
					                        .WithMany("ExternalIDs")
 | 
				
			||||||
 | 
					                        .HasForeignKey("ShowID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.HasOne("Kyoo.Models.People", "People")
 | 
					                    b.HasOne("Kyoo.Models.People", "People")
 | 
				
			||||||
@ -482,6 +561,23 @@ namespace Kyoo.Models.DatabaseMigrations.Internal
 | 
				
			|||||||
                        .IsRequired();
 | 
					                        .IsRequired();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Library", "Library")
 | 
				
			||||||
 | 
					                        .WithMany("Providers")
 | 
				
			||||||
 | 
					                        .HasForeignKey("LibraryID");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.ProviderID", "Provider")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ProviderID")
 | 
				
			||||||
 | 
					                        .OnDelete(DeleteBehavior.Cascade)
 | 
				
			||||||
 | 
					                        .IsRequired();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
 | 
					                        .WithMany()
 | 
				
			||||||
 | 
					                        .HasForeignKey("ShowID");
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
					            modelBuilder.Entity("Kyoo.Models.Season", b =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
					                    b.HasOne("Kyoo.Models.Show", "Show")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user