Fixing metadata ids

This commit is contained in:
Zoe Roux 2021-06-07 22:30:40 +02:00
parent ab8d5c79e4
commit cc672876ae
13 changed files with 810 additions and 350 deletions

View File

@ -1,3 +1,6 @@
using System;
using System.Linq.Expressions;
namespace Kyoo.Models namespace Kyoo.Models
{ {
/// <summary> /// <summary>
@ -16,5 +19,16 @@ namespace Kyoo.Models
/// The URL of the resource on the external provider. /// The URL of the resource on the external provider.
/// </summary> /// </summary>
public string Link { get; set; } public string Link { get; set; }
/// <summary>
/// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs.
/// </summary>
public new static Expression<Func<MetadataID<T>, object>> PrimaryKey
{
get
{
return x => new {First = x.FirstID, Second = x.SecondID};
}
}
} }
} }

View File

@ -212,18 +212,26 @@ namespace Kyoo
.WithMany(x => x.ShowLinks), .WithMany(x => x.ShowLinks),
y => y.HasKey(Link<User, Show>.PrimaryKey)); y => y.HasKey(Link<User, Show>.PrimaryKey));
modelBuilder.Entity<MetadataID<Show>>()
.HasKey(MetadataID<Show>.PrimaryKey);
modelBuilder.Entity<MetadataID<Show>>() modelBuilder.Entity<MetadataID<Show>>()
.HasOne(x => x.First) .HasOne(x => x.First)
.WithMany(x => x.ExternalIDs) .WithMany(x => x.ExternalIDs)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<MetadataID<Season>>()
.HasKey(MetadataID<Season>.PrimaryKey);
modelBuilder.Entity<MetadataID<Season>>() modelBuilder.Entity<MetadataID<Season>>()
.HasOne(x => x.First) .HasOne(x => x.First)
.WithMany(x => x.ExternalIDs) .WithMany(x => x.ExternalIDs)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<MetadataID<Episode>>()
.HasKey(MetadataID<Episode>.PrimaryKey);
modelBuilder.Entity<MetadataID<Episode>>() modelBuilder.Entity<MetadataID<Episode>>()
.HasOne(x => x.First) .HasOne(x => x.First)
.WithMany(x => x.ExternalIDs) .WithMany(x => x.ExternalIDs)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
modelBuilder.Entity<MetadataID<People>>()
.HasKey(MetadataID<People>.PrimaryKey);
modelBuilder.Entity<MetadataID<People>>() modelBuilder.Entity<MetadataID<People>>()
.HasOne(x => x.First) .HasOne(x => x.First)
.WithMany(x => x.ExternalIDs) .WithMany(x => x.ExternalIDs)

View File

@ -12,8 +12,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
</ItemGroup> </ItemGroup>

View File

@ -18,11 +18,11 @@
<!-- </PropertyGroup>--> <!-- </PropertyGroup>-->
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.6">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.5.1" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Kyoo.Postgresql.Migrations namespace Kyoo.Postgresql.Migrations
{ {
[DbContext(typeof(PostgresContext))] [DbContext(typeof(PostgresContext))]
[Migration("20210507203809_Initial")] [Migration("20210607202403_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -23,7 +23,7 @@ namespace Kyoo.Postgresql.Migrations
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" }) .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" }) .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" })
.HasAnnotation("Relational:MaxIdentifierLength", 63) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.5") .HasAnnotation("ProductVersion", "5.0.6")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Kyoo.Models.Collection", b => modelBuilder.Entity("Kyoo.Models.Collection", b =>
@ -76,9 +76,6 @@ namespace Kyoo.Postgresql.Migrations
b.Property<DateTime?>("ReleaseDate") b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<int>("Runtime")
.HasColumnType("integer");
b.Property<int?>("SeasonID") b.Property<int?>("SeasonID")
.HasColumnType("integer"); .HasColumnType("integer");
@ -241,47 +238,88 @@ namespace Kyoo.Postgresql.Migrations
b.ToTable("Link<User, Show>"); b.ToTable("Link<User, Show>");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.Property<int>("ID") b.Property<int>("FirstID")
.ValueGeneratedOnAdd() .HasColumnType("integer");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property<int>("SecondID")
.HasColumnType("integer");
b.Property<string>("DataID") b.Property<string>("DataID")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("EpisodeID") b.Property<string>("Link")
.HasColumnType("text");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Episode>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("SecondID")
.HasColumnType("integer");
b.Property<string>("DataID")
.HasColumnType("text");
b.Property<string>("Link") b.Property<string>("Link")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("PeopleID") b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<People>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("ProviderID") b.Property<int>("SecondID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int?>("SeasonID") b.Property<string>("DataID")
.HasColumnType("text");
b.Property<string>("Link")
.HasColumnType("text");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Season>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int?>("ShowID") b.Property<int>("SecondID")
.HasColumnType("integer"); .HasColumnType("integer");
b.HasKey("ID"); b.Property<string>("DataID")
.HasColumnType("text");
b.HasIndex("EpisodeID"); b.Property<string>("Link")
.HasColumnType("text");
b.HasIndex("PeopleID"); b.HasKey("FirstID", "SecondID");
b.HasIndex("ProviderID"); b.HasIndex("SecondID");
b.HasIndex("SeasonID"); b.ToTable("MetadataID<Show>");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
}); });
modelBuilder.Entity("Kyoo.Models.People", b => modelBuilder.Entity("Kyoo.Models.People", b =>
@ -316,6 +354,9 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<bool>("ForPeople")
.HasColumnType("boolean");
b.Property<int>("PeopleID") b.Property<int>("PeopleID")
.HasColumnType("integer"); .HasColumnType("integer");
@ -372,6 +413,9 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime?>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("Overview") b.Property<string>("Overview")
.HasColumnType("text"); .HasColumnType("text");
@ -384,12 +428,12 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ShowID") b.Property<int>("ShowID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<DateTime?>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("Title") b.Property<string>("Title")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("Year")
.HasColumnType("integer");
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("ShowID", "SeasonNumber") b.HasIndex("ShowID", "SeasonNumber")
@ -411,8 +455,8 @@ namespace Kyoo.Postgresql.Migrations
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("EndYear") b.Property<DateTime?>("EndAir")
.HasColumnType("integer"); .HasColumnType("timestamp without time zone");
b.Property<bool>("IsMovie") b.Property<bool>("IsMovie")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -433,8 +477,8 @@ namespace Kyoo.Postgresql.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("StartYear") b.Property<DateTime?>("StartAir")
.HasColumnType("integer"); .HasColumnType("timestamp without time zone");
b.Property<Status?>("Status") b.Property<Status?>("Status")
.HasColumnType("status"); .HasColumnType("status");
@ -708,43 +752,80 @@ namespace Kyoo.Postgresql.Migrations
b.Navigation("Second"); b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.HasOne("Kyoo.Models.Episode", "Episode") b.HasOne("Kyoo.Models.Episode", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("EpisodeID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Provider", "Provider")
.WithMany("MetadataLinks")
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Kyoo.Models.Season", "Season") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.HasOne("Kyoo.Models.People", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("SeasonID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.HasOne("Kyoo.Models.Season", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People"); b.Navigation("First");
b.Navigation("Provider"); b.Navigation("Second");
});
b.Navigation("Season"); modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.HasOne("Kyoo.Models.Show", "First")
.WithMany("ExternalIDs")
.HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -854,8 +935,6 @@ namespace Kyoo.Postgresql.Migrations
modelBuilder.Entity("Kyoo.Models.Provider", b => modelBuilder.Entity("Kyoo.Models.Provider", b =>
{ {
b.Navigation("LibraryLinks"); b.Navigation("LibraryLinks");
b.Navigation("MetadataLinks");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>

View File

@ -171,6 +171,32 @@ namespace Kyoo.Postgresql.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "MetadataID<People>",
columns: table => new
{
FirstID = table.Column<int>(type: "integer", nullable: false),
SecondID = table.Column<int>(type: "integer", nullable: false),
DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<People>", x => new { x.FirstID, x.SecondID });
table.ForeignKey(
name: "FK_MetadataID<People>_People_FirstID",
column: x => x.FirstID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<People>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Shows", name: "Shows",
columns: table => new columns: table => new
@ -184,8 +210,8 @@ namespace Kyoo.Postgresql.Migrations
Overview = table.Column<string>(type: "text", nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
Status = table.Column<Status>(type: "status", nullable: true), Status = table.Column<Status>(type: "status", nullable: true),
TrailerUrl = table.Column<string>(type: "text", nullable: true), TrailerUrl = table.Column<string>(type: "text", nullable: true),
StartYear = table.Column<int>(type: "integer", nullable: true), StartAir = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
EndYear = table.Column<int>(type: "integer", nullable: true), EndAir = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true), Poster = table.Column<string>(type: "text", nullable: true),
Logo = table.Column<string>(type: "text", nullable: true), Logo = table.Column<string>(type: "text", nullable: true),
Backdrop = table.Column<string>(type: "text", nullable: true), Backdrop = table.Column<string>(type: "text", nullable: true),
@ -299,16 +325,43 @@ namespace Kyoo.Postgresql.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "MetadataID<Show>",
columns: table => new
{
FirstID = table.Column<int>(type: "integer", nullable: false),
SecondID = table.Column<int>(type: "integer", nullable: false),
DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<Show>", x => new { x.FirstID, x.SecondID });
table.ForeignKey(
name: "FK_MetadataID<Show>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<Show>_Shows_FirstID",
column: x => x.FirstID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PeopleRoles", name: "PeopleRoles",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(type: "integer", nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
ForPeople = table.Column<bool>(type: "boolean", nullable: false),
PeopleID = table.Column<int>(type: "integer", nullable: false), PeopleID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(type: "integer", nullable: false), ShowID = table.Column<int>(type: "integer", nullable: false),
Role = table.Column<string>(type: "text", nullable: true), Type = table.Column<string>(type: "text", nullable: true),
Type = table.Column<string>(type: "text", nullable: true) Role = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -337,7 +390,8 @@ namespace Kyoo.Postgresql.Migrations
SeasonNumber = table.Column<int>(type: "integer", nullable: false), SeasonNumber = table.Column<int>(type: "integer", nullable: false),
Title = table.Column<string>(type: "text", nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
Year = table.Column<int>(type: "integer", nullable: true), StartDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
EndDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
Poster = table.Column<string>(type: "text", nullable: true) Poster = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
@ -366,8 +420,7 @@ namespace Kyoo.Postgresql.Migrations
Thumb = table.Column<string>(type: "text", nullable: true), Thumb = table.Column<string>(type: "text", nullable: true),
Title = table.Column<string>(type: "text", nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Overview = table.Column<string>(type: "text", nullable: true), Overview = table.Column<string>(type: "text", nullable: true),
ReleaseDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), ReleaseDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true)
Runtime = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -387,50 +440,53 @@ namespace Kyoo.Postgresql.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "MetadataIds", name: "MetadataID<Season>",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(type: "integer", nullable: false) FirstID = table.Column<int>(type: "integer", nullable: false),
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), SecondID = table.Column<int>(type: "integer", nullable: false),
ProviderID = table.Column<int>(type: "integer", nullable: false),
ShowID = table.Column<int>(type: "integer", nullable: true),
EpisodeID = table.Column<int>(type: "integer", nullable: true),
SeasonID = table.Column<int>(type: "integer", nullable: true),
PeopleID = table.Column<int>(type: "integer", nullable: true),
DataID = table.Column<string>(type: "text", nullable: true), DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true) Link = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_MetadataIds", x => x.ID); table.PrimaryKey("PK_MetadataID<Season>", x => new { x.FirstID, x.SecondID });
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Episodes_EpisodeID", name: "FK_MetadataID<Season>_Providers_SecondID",
column: x => x.EpisodeID, column: x => x.SecondID,
principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_People_PeopleID",
column: x => x.PeopleID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_Providers_ProviderID",
column: x => x.ProviderID,
principalTable: "Providers", principalTable: "Providers",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Seasons_SeasonID", name: "FK_MetadataID<Season>_Seasons_FirstID",
column: x => x.SeasonID, column: x => x.FirstID,
principalTable: "Seasons", principalTable: "Seasons",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MetadataID<Episode>",
columns: table => new
{
FirstID = table.Column<int>(type: "integer", nullable: false),
SecondID = table.Column<int>(type: "integer", nullable: false),
DataID = table.Column<string>(type: "text", nullable: true),
Link = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<Episode>", x => new { x.FirstID, x.SecondID });
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Shows_ShowID", name: "FK_MetadataID<Episode>_Episodes_FirstID",
column: x => x.ShowID, column: x => x.FirstID,
principalTable: "Shows", principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<Episode>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -441,16 +497,16 @@ namespace Kyoo.Postgresql.Migrations
{ {
ID = table.Column<int>(type: "integer", nullable: false) ID = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
EpisodeID = table.Column<int>(type: "integer", nullable: false),
TrackIndex = table.Column<int>(type: "integer", nullable: false),
IsDefault = table.Column<bool>(type: "boolean", nullable: false),
IsForced = table.Column<bool>(type: "boolean", nullable: false),
IsExternal = table.Column<bool>(type: "boolean", nullable: false),
Title = table.Column<string>(type: "text", nullable: true), Title = table.Column<string>(type: "text", nullable: true),
Language = table.Column<string>(type: "text", nullable: true), Language = table.Column<string>(type: "text", nullable: true),
Codec = table.Column<string>(type: "text", nullable: true), Codec = table.Column<string>(type: "text", nullable: true),
IsDefault = table.Column<bool>(type: "boolean", nullable: false),
IsForced = table.Column<bool>(type: "boolean", nullable: false),
IsExternal = table.Column<bool>(type: "boolean", nullable: false),
Path = table.Column<string>(type: "text", nullable: true), Path = table.Column<string>(type: "text", nullable: true),
Type = table.Column<StreamType>(type: "stream_type", nullable: false) Type = table.Column<StreamType>(type: "stream_type", nullable: false),
EpisodeID = table.Column<int>(type: "integer", nullable: false),
TrackIndex = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -548,29 +604,24 @@ namespace Kyoo.Postgresql.Migrations
column: "SecondID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_EpisodeID", name: "IX_MetadataID<Episode>_SecondID",
table: "MetadataIds", table: "MetadataID<Episode>",
column: "EpisodeID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_PeopleID", name: "IX_MetadataID<People>_SecondID",
table: "MetadataIds", table: "MetadataID<People>",
column: "PeopleID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ProviderID", name: "IX_MetadataID<Season>_SecondID",
table: "MetadataIds", table: "MetadataID<Season>",
column: "ProviderID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_SeasonID", name: "IX_MetadataID<Show>_SecondID",
table: "MetadataIds", table: "MetadataID<Show>",
column: "SeasonID"); column: "SecondID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ShowID",
table: "MetadataIds",
column: "ShowID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_People_Slug", name: "IX_People_Slug",
@ -656,7 +707,16 @@ namespace Kyoo.Postgresql.Migrations
name: "Link<User, Show>"); name: "Link<User, Show>");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "MetadataIds"); name: "MetadataID<Episode>");
migrationBuilder.DropTable(
name: "MetadataID<People>");
migrationBuilder.DropTable(
name: "MetadataID<Season>");
migrationBuilder.DropTable(
name: "MetadataID<Show>");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PeopleRoles"); name: "PeopleRoles");

View File

@ -21,7 +21,7 @@ namespace Kyoo.Postgresql.Migrations
.HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" }) .HasPostgresEnum(null, "status", new[] { "finished", "airing", "planned", "unknown" })
.HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" }) .HasPostgresEnum(null, "stream_type", new[] { "unknown", "video", "audio", "subtitle", "attachment" })
.HasAnnotation("Relational:MaxIdentifierLength", 63) .HasAnnotation("Relational:MaxIdentifierLength", 63)
.HasAnnotation("ProductVersion", "5.0.5") .HasAnnotation("ProductVersion", "5.0.6")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
modelBuilder.Entity("Kyoo.Models.Collection", b => modelBuilder.Entity("Kyoo.Models.Collection", b =>
@ -74,9 +74,6 @@ namespace Kyoo.Postgresql.Migrations
b.Property<DateTime?>("ReleaseDate") b.Property<DateTime?>("ReleaseDate")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<int>("Runtime")
.HasColumnType("integer");
b.Property<int?>("SeasonID") b.Property<int?>("SeasonID")
.HasColumnType("integer"); .HasColumnType("integer");
@ -239,47 +236,88 @@ namespace Kyoo.Postgresql.Migrations
b.ToTable("Link<User, Show>"); b.ToTable("Link<User, Show>");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.Property<int>("ID") b.Property<int>("FirstID")
.ValueGeneratedOnAdd() .HasColumnType("integer");
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); b.Property<int>("SecondID")
.HasColumnType("integer");
b.Property<string>("DataID") b.Property<string>("DataID")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("EpisodeID") b.Property<string>("Link")
.HasColumnType("text");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Episode>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("SecondID")
.HasColumnType("integer");
b.Property<string>("DataID")
.HasColumnType("text");
b.Property<string>("Link") b.Property<string>("Link")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("PeopleID") b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<People>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("ProviderID") b.Property<int>("SecondID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int?>("SeasonID") b.Property<string>("DataID")
.HasColumnType("text");
b.Property<string>("Link")
.HasColumnType("text");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Season>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int?>("ShowID") b.Property<int>("SecondID")
.HasColumnType("integer"); .HasColumnType("integer");
b.HasKey("ID"); b.Property<string>("DataID")
.HasColumnType("text");
b.HasIndex("EpisodeID"); b.Property<string>("Link")
.HasColumnType("text");
b.HasIndex("PeopleID"); b.HasKey("FirstID", "SecondID");
b.HasIndex("ProviderID"); b.HasIndex("SecondID");
b.HasIndex("SeasonID"); b.ToTable("MetadataID<Show>");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
}); });
modelBuilder.Entity("Kyoo.Models.People", b => modelBuilder.Entity("Kyoo.Models.People", b =>
@ -314,6 +352,9 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<bool>("ForPeople")
.HasColumnType("boolean");
b.Property<int>("PeopleID") b.Property<int>("PeopleID")
.HasColumnType("integer"); .HasColumnType("integer");
@ -370,6 +411,9 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<DateTime?>("EndDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("Overview") b.Property<string>("Overview")
.HasColumnType("text"); .HasColumnType("text");
@ -382,12 +426,12 @@ namespace Kyoo.Postgresql.Migrations
b.Property<int>("ShowID") b.Property<int>("ShowID")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<DateTime?>("StartDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("Title") b.Property<string>("Title")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("Year")
.HasColumnType("integer");
b.HasKey("ID"); b.HasKey("ID");
b.HasIndex("ShowID", "SeasonNumber") b.HasIndex("ShowID", "SeasonNumber")
@ -409,8 +453,8 @@ namespace Kyoo.Postgresql.Migrations
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("EndYear") b.Property<DateTime?>("EndAir")
.HasColumnType("integer"); .HasColumnType("timestamp without time zone");
b.Property<bool>("IsMovie") b.Property<bool>("IsMovie")
.HasColumnType("boolean"); .HasColumnType("boolean");
@ -431,8 +475,8 @@ namespace Kyoo.Postgresql.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("StartYear") b.Property<DateTime?>("StartAir")
.HasColumnType("integer"); .HasColumnType("timestamp without time zone");
b.Property<Status?>("Status") b.Property<Status?>("Status")
.HasColumnType("status"); .HasColumnType("status");
@ -706,43 +750,80 @@ namespace Kyoo.Postgresql.Migrations
b.Navigation("Second"); b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.HasOne("Kyoo.Models.Episode", "Episode") b.HasOne("Kyoo.Models.Episode", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("EpisodeID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Provider", "Provider")
.WithMany("MetadataLinks")
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Kyoo.Models.Season", "Season") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.HasOne("Kyoo.Models.People", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("SeasonID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.HasOne("Kyoo.Models.Season", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People"); b.Navigation("First");
b.Navigation("Provider"); b.Navigation("Second");
});
b.Navigation("Season"); modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.HasOne("Kyoo.Models.Show", "First")
.WithMany("ExternalIDs")
.HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -852,8 +933,6 @@ namespace Kyoo.Postgresql.Migrations
modelBuilder.Entity("Kyoo.Models.Provider", b => modelBuilder.Entity("Kyoo.Models.Provider", b =>
{ {
b.Navigation("LibraryLinks"); b.Navigation("LibraryLinks");
b.Navigation("MetadataLinks");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>

View File

@ -19,7 +19,7 @@
<!-- </PropertyGroup>--> <!-- </PropertyGroup>-->
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.6">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

View File

@ -6,10 +6,10 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Kyoo.SQLite.Migrations namespace Kyoo.SqLite.Migrations
{ {
[DbContext(typeof(SqLiteContext))] [DbContext(typeof(SqLiteContext))]
[Migration("20210529124408_Initial")] [Migration("20210607202259_Initial")]
partial class Initial partial class Initial
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -66,9 +66,6 @@ namespace Kyoo.SQLite.Migrations
b.Property<DateTime?>("ReleaseDate") b.Property<DateTime?>("ReleaseDate")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("Runtime")
.HasColumnType("INTEGER");
b.Property<int?>("SeasonID") b.Property<int?>("SeasonID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -229,46 +226,88 @@ namespace Kyoo.SQLite.Migrations
b.ToTable("Link<User, Show>"); b.ToTable("Link<User, Show>");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.Property<int>("ID") b.Property<int>("FirstID")
.ValueGeneratedOnAdd() .HasColumnType("INTEGER");
b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("DataID") b.Property<string>("DataID")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("EpisodeID") b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Episode>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("SecondID")
.HasColumnType("INTEGER");
b.Property<string>("DataID")
.HasColumnType("TEXT");
b.Property<string>("Link") b.Property<string>("Link")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("PeopleID") b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<People>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("ProviderID") b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int?>("SeasonID") b.Property<string>("DataID")
.HasColumnType("TEXT");
b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Season>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int?>("ShowID") b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.HasKey("ID"); b.Property<string>("DataID")
.HasColumnType("TEXT");
b.HasIndex("EpisodeID"); b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasIndex("PeopleID"); b.HasKey("FirstID", "SecondID");
b.HasIndex("ProviderID"); b.HasIndex("SecondID");
b.HasIndex("SeasonID"); b.ToTable("MetadataID<Show>");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
}); });
modelBuilder.Entity("Kyoo.Models.People", b => modelBuilder.Entity("Kyoo.Models.People", b =>
@ -301,6 +340,9 @@ namespace Kyoo.SQLite.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<bool>("ForPeople")
.HasColumnType("INTEGER");
b.Property<int>("PeopleID") b.Property<int>("PeopleID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -355,6 +397,9 @@ namespace Kyoo.SQLite.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<DateTime?>("EndDate")
.HasColumnType("TEXT");
b.Property<string>("Overview") b.Property<string>("Overview")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@ -367,11 +412,11 @@ namespace Kyoo.SQLite.Migrations
b.Property<int>("ShowID") b.Property<int>("ShowID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Title") b.Property<DateTime?>("StartDate")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("Year") b.Property<string>("Title")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.HasKey("ID"); b.HasKey("ID");
@ -393,8 +438,8 @@ namespace Kyoo.SQLite.Migrations
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("EndYear") b.Property<DateTime?>("EndAir")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.Property<bool>("IsMovie") b.Property<bool>("IsMovie")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -415,8 +460,8 @@ namespace Kyoo.SQLite.Migrations
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("StartYear") b.Property<DateTime?>("StartAir")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.Property<int?>("Status") b.Property<int?>("Status")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -687,43 +732,80 @@ namespace Kyoo.SQLite.Migrations
b.Navigation("Second"); b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.HasOne("Kyoo.Models.Episode", "Episode") b.HasOne("Kyoo.Models.Episode", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("EpisodeID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Provider", "Provider")
.WithMany("MetadataLinks")
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Kyoo.Models.Season", "Season") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.HasOne("Kyoo.Models.People", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("SeasonID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.HasOne("Kyoo.Models.Season", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People"); b.Navigation("First");
b.Navigation("Provider"); b.Navigation("Second");
});
b.Navigation("Season"); modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.HasOne("Kyoo.Models.Show", "First")
.WithMany("ExternalIDs")
.HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -833,8 +915,6 @@ namespace Kyoo.SQLite.Migrations
modelBuilder.Entity("Kyoo.Models.Provider", b => modelBuilder.Entity("Kyoo.Models.Provider", b =>
{ {
b.Navigation("LibraryLinks"); b.Navigation("LibraryLinks");
b.Navigation("MetadataLinks");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>

View File

@ -1,7 +1,7 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Kyoo.SQLite.Migrations namespace Kyoo.SqLite.Migrations
{ {
public partial class Initial : Migration public partial class Initial : Migration
{ {
@ -163,6 +163,32 @@ namespace Kyoo.SQLite.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "MetadataID<People>",
columns: table => new
{
FirstID = table.Column<int>(type: "INTEGER", nullable: false),
SecondID = table.Column<int>(type: "INTEGER", nullable: false),
DataID = table.Column<string>(type: "TEXT", nullable: true),
Link = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<People>", x => new { x.FirstID, x.SecondID });
table.ForeignKey(
name: "FK_MetadataID<People>_People_FirstID",
column: x => x.FirstID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<People>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Shows", name: "Shows",
columns: table => new columns: table => new
@ -176,8 +202,8 @@ namespace Kyoo.SQLite.Migrations
Overview = table.Column<string>(type: "TEXT", nullable: true), Overview = table.Column<string>(type: "TEXT", nullable: true),
Status = table.Column<int>(type: "INTEGER", nullable: true), Status = table.Column<int>(type: "INTEGER", nullable: true),
TrailerUrl = table.Column<string>(type: "TEXT", nullable: true), TrailerUrl = table.Column<string>(type: "TEXT", nullable: true),
StartYear = table.Column<int>(type: "INTEGER", nullable: true), StartAir = table.Column<DateTime>(type: "TEXT", nullable: true),
EndYear = table.Column<int>(type: "INTEGER", nullable: true), EndAir = table.Column<DateTime>(type: "TEXT", nullable: true),
Poster = table.Column<string>(type: "TEXT", nullable: true), Poster = table.Column<string>(type: "TEXT", nullable: true),
Logo = table.Column<string>(type: "TEXT", nullable: true), Logo = table.Column<string>(type: "TEXT", nullable: true),
Backdrop = table.Column<string>(type: "TEXT", nullable: true), Backdrop = table.Column<string>(type: "TEXT", nullable: true),
@ -291,16 +317,43 @@ namespace Kyoo.SQLite.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "MetadataID<Show>",
columns: table => new
{
FirstID = table.Column<int>(type: "INTEGER", nullable: false),
SecondID = table.Column<int>(type: "INTEGER", nullable: false),
DataID = table.Column<string>(type: "TEXT", nullable: true),
Link = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<Show>", x => new { x.FirstID, x.SecondID });
table.ForeignKey(
name: "FK_MetadataID<Show>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<Show>_Shows_FirstID",
column: x => x.FirstID,
principalTable: "Shows",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "PeopleRoles", name: "PeopleRoles",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
ForPeople = table.Column<bool>(type: "INTEGER", nullable: false),
PeopleID = table.Column<int>(type: "INTEGER", nullable: false), PeopleID = table.Column<int>(type: "INTEGER", nullable: false),
ShowID = table.Column<int>(type: "INTEGER", nullable: false), ShowID = table.Column<int>(type: "INTEGER", nullable: false),
Role = table.Column<string>(type: "TEXT", nullable: true), Type = table.Column<string>(type: "TEXT", nullable: true),
Type = table.Column<string>(type: "TEXT", nullable: true) Role = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -329,7 +382,8 @@ namespace Kyoo.SQLite.Migrations
SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false), SeasonNumber = table.Column<int>(type: "INTEGER", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Overview = table.Column<string>(type: "TEXT", nullable: true), Overview = table.Column<string>(type: "TEXT", nullable: true),
Year = table.Column<int>(type: "INTEGER", nullable: true), StartDate = table.Column<DateTime>(type: "TEXT", nullable: true),
EndDate = table.Column<DateTime>(type: "TEXT", nullable: true),
Poster = table.Column<string>(type: "TEXT", nullable: true) Poster = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
@ -358,8 +412,7 @@ namespace Kyoo.SQLite.Migrations
Thumb = table.Column<string>(type: "TEXT", nullable: true), Thumb = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Overview = table.Column<string>(type: "TEXT", nullable: true), Overview = table.Column<string>(type: "TEXT", nullable: true),
ReleaseDate = table.Column<DateTime>(type: "TEXT", nullable: true), ReleaseDate = table.Column<DateTime>(type: "TEXT", nullable: true)
Runtime = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -379,50 +432,53 @@ namespace Kyoo.SQLite.Migrations
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "MetadataIds", name: "MetadataID<Season>",
columns: table => new columns: table => new
{ {
ID = table.Column<int>(type: "INTEGER", nullable: false) FirstID = table.Column<int>(type: "INTEGER", nullable: false),
.Annotation("Sqlite:Autoincrement", true), SecondID = table.Column<int>(type: "INTEGER", nullable: false),
ProviderID = table.Column<int>(type: "INTEGER", nullable: false),
ShowID = table.Column<int>(type: "INTEGER", nullable: true),
EpisodeID = table.Column<int>(type: "INTEGER", nullable: true),
SeasonID = table.Column<int>(type: "INTEGER", nullable: true),
PeopleID = table.Column<int>(type: "INTEGER", nullable: true),
DataID = table.Column<string>(type: "TEXT", nullable: true), DataID = table.Column<string>(type: "TEXT", nullable: true),
Link = table.Column<string>(type: "TEXT", nullable: true) Link = table.Column<string>(type: "TEXT", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_MetadataIds", x => x.ID); table.PrimaryKey("PK_MetadataID<Season>", x => new { x.FirstID, x.SecondID });
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Episodes_EpisodeID", name: "FK_MetadataID<Season>_Providers_SecondID",
column: x => x.EpisodeID, column: x => x.SecondID,
principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_People_PeopleID",
column: x => x.PeopleID,
principalTable: "People",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataIds_Providers_ProviderID",
column: x => x.ProviderID,
principalTable: "Providers", principalTable: "Providers",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Seasons_SeasonID", name: "FK_MetadataID<Season>_Seasons_FirstID",
column: x => x.SeasonID, column: x => x.FirstID,
principalTable: "Seasons", principalTable: "Seasons",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "MetadataID<Episode>",
columns: table => new
{
FirstID = table.Column<int>(type: "INTEGER", nullable: false),
SecondID = table.Column<int>(type: "INTEGER", nullable: false),
DataID = table.Column<string>(type: "TEXT", nullable: true),
Link = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MetadataID<Episode>", x => new { x.FirstID, x.SecondID });
table.ForeignKey( table.ForeignKey(
name: "FK_MetadataIds_Shows_ShowID", name: "FK_MetadataID<Episode>_Episodes_FirstID",
column: x => x.ShowID, column: x => x.FirstID,
principalTable: "Shows", principalTable: "Episodes",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_MetadataID<Episode>_Providers_SecondID",
column: x => x.SecondID,
principalTable: "Providers",
principalColumn: "ID", principalColumn: "ID",
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
@ -433,16 +489,16 @@ namespace Kyoo.SQLite.Migrations
{ {
ID = table.Column<int>(type: "INTEGER", nullable: false) ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true), .Annotation("Sqlite:Autoincrement", true),
EpisodeID = table.Column<int>(type: "INTEGER", nullable: false),
TrackIndex = table.Column<int>(type: "INTEGER", nullable: false),
IsDefault = table.Column<bool>(type: "INTEGER", nullable: false),
IsForced = table.Column<bool>(type: "INTEGER", nullable: false),
IsExternal = table.Column<bool>(type: "INTEGER", nullable: false),
Title = table.Column<string>(type: "TEXT", nullable: true), Title = table.Column<string>(type: "TEXT", nullable: true),
Language = table.Column<string>(type: "TEXT", nullable: true), Language = table.Column<string>(type: "TEXT", nullable: true),
Codec = table.Column<string>(type: "TEXT", nullable: true), Codec = table.Column<string>(type: "TEXT", nullable: true),
IsDefault = table.Column<bool>(type: "INTEGER", nullable: false),
IsForced = table.Column<bool>(type: "INTEGER", nullable: false),
IsExternal = table.Column<bool>(type: "INTEGER", nullable: false),
Path = table.Column<string>(type: "TEXT", nullable: true), Path = table.Column<string>(type: "TEXT", nullable: true),
Type = table.Column<int>(type: "INTEGER", nullable: false) Type = table.Column<int>(type: "INTEGER", nullable: false),
EpisodeID = table.Column<int>(type: "INTEGER", nullable: false),
TrackIndex = table.Column<int>(type: "INTEGER", nullable: false)
}, },
constraints: table => constraints: table =>
{ {
@ -540,29 +596,24 @@ namespace Kyoo.SQLite.Migrations
column: "SecondID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_EpisodeID", name: "IX_MetadataID<Episode>_SecondID",
table: "MetadataIds", table: "MetadataID<Episode>",
column: "EpisodeID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_PeopleID", name: "IX_MetadataID<People>_SecondID",
table: "MetadataIds", table: "MetadataID<People>",
column: "PeopleID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ProviderID", name: "IX_MetadataID<Season>_SecondID",
table: "MetadataIds", table: "MetadataID<Season>",
column: "ProviderID"); column: "SecondID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_MetadataIds_SeasonID", name: "IX_MetadataID<Show>_SecondID",
table: "MetadataIds", table: "MetadataID<Show>",
column: "SeasonID"); column: "SecondID");
migrationBuilder.CreateIndex(
name: "IX_MetadataIds_ShowID",
table: "MetadataIds",
column: "ShowID");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_People_Slug", name: "IX_People_Slug",
@ -648,7 +699,16 @@ namespace Kyoo.SQLite.Migrations
name: "Link<User, Show>"); name: "Link<User, Show>");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "MetadataIds"); name: "MetadataID<Episode>");
migrationBuilder.DropTable(
name: "MetadataID<People>");
migrationBuilder.DropTable(
name: "MetadataID<Season>");
migrationBuilder.DropTable(
name: "MetadataID<Show>");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "PeopleRoles"); name: "PeopleRoles");

View File

@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Kyoo.SQLite.Migrations namespace Kyoo.SqLite.Migrations
{ {
[DbContext(typeof(SqLiteContext))] [DbContext(typeof(SqLiteContext))]
partial class SqLiteContextModelSnapshot : ModelSnapshot partial class SqLiteContextModelSnapshot : ModelSnapshot
@ -64,9 +64,6 @@ namespace Kyoo.SQLite.Migrations
b.Property<DateTime?>("ReleaseDate") b.Property<DateTime?>("ReleaseDate")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int>("Runtime")
.HasColumnType("INTEGER");
b.Property<int?>("SeasonID") b.Property<int?>("SeasonID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -227,46 +224,88 @@ namespace Kyoo.SQLite.Migrations
b.ToTable("Link<User, Show>"); b.ToTable("Link<User, Show>");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.Property<int>("ID") b.Property<int>("FirstID")
.ValueGeneratedOnAdd() .HasColumnType("INTEGER");
b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("DataID") b.Property<string>("DataID")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("EpisodeID") b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Episode>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("SecondID")
.HasColumnType("INTEGER");
b.Property<string>("DataID")
.HasColumnType("TEXT");
b.Property<string>("Link") b.Property<string>("Link")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("PeopleID") b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<People>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int>("ProviderID") b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int?>("SeasonID") b.Property<string>("DataID")
.HasColumnType("TEXT");
b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasKey("FirstID", "SecondID");
b.HasIndex("SecondID");
b.ToTable("MetadataID<Season>");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.Property<int>("FirstID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<int?>("ShowID") b.Property<int>("SecondID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.HasKey("ID"); b.Property<string>("DataID")
.HasColumnType("TEXT");
b.HasIndex("EpisodeID"); b.Property<string>("Link")
.HasColumnType("TEXT");
b.HasIndex("PeopleID"); b.HasKey("FirstID", "SecondID");
b.HasIndex("ProviderID"); b.HasIndex("SecondID");
b.HasIndex("SeasonID"); b.ToTable("MetadataID<Show>");
b.HasIndex("ShowID");
b.ToTable("MetadataIds");
}); });
modelBuilder.Entity("Kyoo.Models.People", b => modelBuilder.Entity("Kyoo.Models.People", b =>
@ -299,6 +338,9 @@ namespace Kyoo.SQLite.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<bool>("ForPeople")
.HasColumnType("INTEGER");
b.Property<int>("PeopleID") b.Property<int>("PeopleID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -353,6 +395,9 @@ namespace Kyoo.SQLite.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<DateTime?>("EndDate")
.HasColumnType("TEXT");
b.Property<string>("Overview") b.Property<string>("Overview")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
@ -365,11 +410,11 @@ namespace Kyoo.SQLite.Migrations
b.Property<int>("ShowID") b.Property<int>("ShowID")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
b.Property<string>("Title") b.Property<DateTime?>("StartDate")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("Year") b.Property<string>("Title")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.HasKey("ID"); b.HasKey("ID");
@ -391,8 +436,8 @@ namespace Kyoo.SQLite.Migrations
b.Property<string>("Backdrop") b.Property<string>("Backdrop")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("EndYear") b.Property<DateTime?>("EndAir")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.Property<bool>("IsMovie") b.Property<bool>("IsMovie")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -413,8 +458,8 @@ namespace Kyoo.SQLite.Migrations
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<int?>("StartYear") b.Property<DateTime?>("StartAir")
.HasColumnType("INTEGER"); .HasColumnType("TEXT");
b.Property<int?>("Status") b.Property<int?>("Status")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");
@ -685,43 +730,80 @@ namespace Kyoo.SQLite.Migrations
b.Navigation("Second"); b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.MetadataID", b => modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Episode>", b =>
{ {
b.HasOne("Kyoo.Models.Episode", "Episode") b.HasOne("Kyoo.Models.Episode", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("EpisodeID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.People", "People")
.WithMany("ExternalIDs")
.HasForeignKey("PeopleID")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Kyoo.Models.Provider", "Provider")
.WithMany("MetadataLinks")
.HasForeignKey("ProviderID")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("Kyoo.Models.Season", "Season") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.People>", b =>
{
b.HasOne("Kyoo.Models.People", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("SeasonID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Kyoo.Models.Show", "Show") b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
});
modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Season>", b =>
{
b.HasOne("Kyoo.Models.Season", "First")
.WithMany("ExternalIDs") .WithMany("ExternalIDs")
.HasForeignKey("ShowID") .HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Episode"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("People"); b.Navigation("First");
b.Navigation("Provider"); b.Navigation("Second");
});
b.Navigation("Season"); modelBuilder.Entity("Kyoo.Models.MetadataID<Kyoo.Models.Show>", b =>
{
b.HasOne("Kyoo.Models.Show", "First")
.WithMany("ExternalIDs")
.HasForeignKey("FirstID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Show"); b.HasOne("Kyoo.Models.Provider", "Second")
.WithMany()
.HasForeignKey("SecondID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("First");
b.Navigation("Second");
}); });
modelBuilder.Entity("Kyoo.Models.PeopleRole", b => modelBuilder.Entity("Kyoo.Models.PeopleRole", b =>
@ -831,8 +913,6 @@ namespace Kyoo.SQLite.Migrations
modelBuilder.Entity("Kyoo.Models.Provider", b => modelBuilder.Entity("Kyoo.Models.Provider", b =>
{ {
b.Navigation("LibraryLinks"); b.Navigation("LibraryLinks");
b.Navigation("MetadataLinks");
}); });
modelBuilder.Entity("Kyoo.Models.Season", b => modelBuilder.Entity("Kyoo.Models.Season", b =>

View File

@ -14,7 +14,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="xunit" Version="2.4.1" /> <PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View File

@ -35,9 +35,9 @@
<ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" /> <ProjectReference Include="../Kyoo.Common/Kyoo.Common.csproj" />
<ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" /> <ProjectReference Include="../Kyoo.CommonAPI/Kyoo.CommonAPI.csproj" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" /> <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.14" /> <PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.1.15" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.5" /> <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.6" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>