mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Deletion of episodes works
This commit is contained in:
parent
0952197cf6
commit
5944d948f1
@ -11,7 +11,7 @@ namespace Kyoo.Models
|
||||
public string Slug { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
[NotMergable] [JsonIgnore] public IEnumerable<GenreLink> Links { get; set; }
|
||||
[NotMergable] [JsonIgnore] public virtual IEnumerable<GenreLink> Links { get; set; }
|
||||
|
||||
[NotMergable] [JsonIgnore] public IEnumerable<Show> Shows
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace Kyoo.Models
|
||||
set => LibraryLinks = value?.Select(x => new LibraryLink(x, this));
|
||||
}
|
||||
|
||||
[NotMergable] [JsonIgnore] public IEnumerable<CollectionLink> CollectionLinks { get; set; }
|
||||
[NotMergable] [JsonIgnore] public virtual IEnumerable<CollectionLink> CollectionLinks { get; set; }
|
||||
|
||||
[NotMergable] [JsonIgnore] public IEnumerable<Collection> Collections
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
||||
using Kyoo.Models;
|
||||
using Kyoo.Models.Exceptions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
|
||||
namespace Kyoo.Controllers
|
||||
{
|
||||
@ -86,9 +87,10 @@ namespace Kyoo.Controllers
|
||||
foreach (MetadataID entry in obj.ExternalIDs)
|
||||
_database.Entry(entry).State = EntityState.Added;
|
||||
|
||||
// Since Episodes & Tracks are on the same DB, using a single commit is quicker.
|
||||
if (obj.Tracks != null)
|
||||
foreach (Track track in obj.Tracks)
|
||||
await _tracks.Create(track);
|
||||
foreach (Track entry in obj.Tracks)
|
||||
_database.Entry(entry).State = EntityState.Added;
|
||||
|
||||
try
|
||||
{
|
||||
@ -102,6 +104,16 @@ namespace Kyoo.Controllers
|
||||
throw new DuplicatedItemException($"Trying to insert a duplicated episode (slug {obj.Slug} already exists).");
|
||||
throw;
|
||||
}
|
||||
|
||||
// Since Episodes & Tracks are on the same DB, using a single commit is quicker.
|
||||
/*if (obj.Tracks != null)
|
||||
* foreach (Track track in obj.Tracks)
|
||||
* {
|
||||
* track.EpisodeID = obj.ID;
|
||||
* await _tracks.Create(track);
|
||||
* }
|
||||
*/
|
||||
|
||||
return obj.ID;
|
||||
}
|
||||
|
||||
@ -179,13 +191,17 @@ namespace Kyoo.Controllers
|
||||
if (obj == null)
|
||||
throw new ArgumentNullException(nameof(obj));
|
||||
|
||||
_database.Entry(obj).State = EntityState.Deleted;
|
||||
if (obj.ExternalIDs != null)
|
||||
foreach (MetadataID entry in obj.ExternalIDs)
|
||||
_database.Entry(entry).State = EntityState.Deleted;
|
||||
if (obj.Tracks != null)
|
||||
foreach (Track entry in obj.Tracks)
|
||||
await _tracks.Delete(entry);
|
||||
_database.Episodes.Remove(obj);
|
||||
|
||||
// Since Tracks & Episodes are on the same database and handled by dotnet-ef, we can't use the repository to delete them.
|
||||
/*if (obj.Tracks != null)
|
||||
* foreach (Track entry in obj.Tracks)
|
||||
* await _tracks.Delete(entry);
|
||||
*/
|
||||
|
||||
await _database.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,8 @@ namespace Kyoo
|
||||
.Ignore(x => x.Providers);
|
||||
|
||||
modelBuilder.Entity<Collection>()
|
||||
.Ignore(x => x.Shows);
|
||||
.Ignore(x => x.Shows)
|
||||
.Ignore(x => x.Libraries);
|
||||
|
||||
modelBuilder.Entity<Show>()
|
||||
.Ignore(x => x.Genres)
|
||||
@ -125,6 +126,9 @@ namespace Kyoo
|
||||
.Ignore(x => x.Name)
|
||||
.Ignore(x => x.ExternalIDs);
|
||||
|
||||
modelBuilder.Entity<Genre>()
|
||||
.Ignore(x => x.Shows);
|
||||
|
||||
|
||||
modelBuilder.Entity<Collection>()
|
||||
.HasIndex(x => x.Slug)
|
||||
|
@ -1,640 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Kyoo;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
[Migration("20200618133537_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Collection", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Collections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("CollectionLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Episode", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("AbsoluteNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("ReleaseDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Runtime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SeasonID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("SeasonID");
|
||||
|
||||
b.HasIndex("ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Genre", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Genres");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("GenreID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ShowID", "GenreID");
|
||||
|
||||
b.HasIndex("GenreID");
|
||||
|
||||
b.ToTable("GenreLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Library", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Paths")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Libraries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("LibraryLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("DataID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EpisodeID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Link")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PeopleID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProviderID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SeasonID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EpisodeID");
|
||||
|
||||
b.HasIndex("PeopleID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
|
||||
b.HasIndex("SeasonID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("MetadataIds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.People", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Peoples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("PeopleID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Role")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("PeopleID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("PeopleLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Logo")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Providers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProviderID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
|
||||
b.ToTable("ProviderLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Year")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ShowID", "SeasonNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Seasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Aliases")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Backdrop")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EndYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsMovie")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Logo")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("StartYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("StudioID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TrailerUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("StudioID");
|
||||
|
||||
b.ToTable("Shows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Studio", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Studios");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Track", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Codec")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("EpisodeID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsExternal")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsForced")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EpisodeID");
|
||||
|
||||
b.ToTable("Tracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Episode", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Season", "Season")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Genre", "Genre")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("GenreLinks")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("LibraryID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Episode", "Episode")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("EpisodeID");
|
||||
|
||||
b.HasOne("Kyoo.Models.People", "People")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("PeopleID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProviderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Season", "Season")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.People", "People")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("PeopleID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("People")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany("ProviderLinks")
|
||||
.HasForeignKey("LibraryID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProviderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Studio", "Studio")
|
||||
.WithMany("Shows")
|
||||
.HasForeignKey("StudioID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Track", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Episode", "Episode")
|
||||
.WithMany("Tracks")
|
||||
.HasForeignKey("EpisodeID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,594 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Collections",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Poster = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
ImgPrimary = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Collections", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Genres",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Genres", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Libraries",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Paths = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Libraries", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Peoples",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
ImgPrimary = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Peoples", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Providers",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Name = table.Column<string>(nullable: true),
|
||||
Logo = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Providers", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Studios",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Name = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Studios", x => x.ID);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProviderLinks",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProviderID = table.Column<int>(nullable: false),
|
||||
LibraryID = table.Column<int>(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_Providers_ProviderID",
|
||||
column: x => x.ProviderID,
|
||||
principalTable: "Providers",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Shows",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Slug = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Aliases = table.Column<string>(nullable: true),
|
||||
Path = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
Status = table.Column<int>(nullable: true),
|
||||
TrailerUrl = table.Column<string>(nullable: true),
|
||||
StartYear = table.Column<int>(nullable: true),
|
||||
EndYear = table.Column<int>(nullable: true),
|
||||
Poster = table.Column<string>(nullable: true),
|
||||
Logo = table.Column<string>(nullable: true),
|
||||
Backdrop = table.Column<string>(nullable: true),
|
||||
IsMovie = table.Column<bool>(nullable: false),
|
||||
StudioID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Shows", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Shows_Studios_StudioID",
|
||||
column: x => x.StudioID,
|
||||
principalTable: "Studios",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CollectionLinks",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CollectionID = table.Column<int>(nullable: true),
|
||||
ShowID = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CollectionLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Collections_CollectionID",
|
||||
column: x => x.CollectionID,
|
||||
principalTable: "Collections",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_CollectionLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GenreLinks",
|
||||
columns: table => new
|
||||
{
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
GenreID = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GenreLinks", x => new { x.ShowID, x.GenreID });
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Genres_GenreID",
|
||||
column: x => x.GenreID,
|
||||
principalTable: "Genres",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_GenreLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LibraryLinks",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
LibraryID = table.Column<int>(nullable: false),
|
||||
ShowID = table.Column<int>(nullable: true),
|
||||
CollectionID = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LibraryLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Collections_CollectionID",
|
||||
column: x => x.CollectionID,
|
||||
principalTable: "Collections",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Libraries_LibraryID",
|
||||
column: x => x.LibraryID,
|
||||
principalTable: "Libraries",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_LibraryLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PeopleLinks",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PeopleID = table.Column<int>(nullable: false),
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
Role = table.Column<string>(nullable: true),
|
||||
Type = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PeopleLinks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_PeopleLinks_Peoples_PeopleID",
|
||||
column: x => x.PeopleID,
|
||||
principalTable: "Peoples",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PeopleLinks_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Seasons",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
SeasonNumber = table.Column<int>(nullable: false),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
Year = table.Column<int>(nullable: true),
|
||||
ImgPrimary = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Seasons", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Seasons_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Episodes",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ShowID = table.Column<int>(nullable: false),
|
||||
SeasonID = table.Column<int>(nullable: true),
|
||||
SeasonNumber = table.Column<int>(nullable: false),
|
||||
EpisodeNumber = table.Column<int>(nullable: false),
|
||||
AbsoluteNumber = table.Column<int>(nullable: false),
|
||||
Path = table.Column<string>(nullable: true),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Overview = table.Column<string>(nullable: true),
|
||||
ReleaseDate = table.Column<DateTime>(nullable: true),
|
||||
Runtime = table.Column<int>(nullable: false),
|
||||
ImgPrimary = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Episodes", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Episodes_Seasons_SeasonID",
|
||||
column: x => x.SeasonID,
|
||||
principalTable: "Seasons",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_Episodes_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MetadataIds",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ProviderID = table.Column<int>(nullable: false),
|
||||
ShowID = table.Column<int>(nullable: true),
|
||||
EpisodeID = table.Column<int>(nullable: true),
|
||||
SeasonID = table.Column<int>(nullable: true),
|
||||
PeopleID = table.Column<int>(nullable: true),
|
||||
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_Episodes_EpisodeID",
|
||||
column: x => x.EpisodeID,
|
||||
principalTable: "Episodes",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MetadataIds_Peoples_PeopleID",
|
||||
column: x => x.PeopleID,
|
||||
principalTable: "Peoples",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MetadataIds_Providers_ProviderID",
|
||||
column: x => x.ProviderID,
|
||||
principalTable: "Providers",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_MetadataIds_Seasons_SeasonID",
|
||||
column: x => x.SeasonID,
|
||||
principalTable: "Seasons",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_MetadataIds_Shows_ShowID",
|
||||
column: x => x.ShowID,
|
||||
principalTable: "Shows",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tracks",
|
||||
columns: table => new
|
||||
{
|
||||
ID = table.Column<int>(nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Title = table.Column<string>(nullable: true),
|
||||
Language = table.Column<string>(nullable: true),
|
||||
Codec = table.Column<string>(nullable: true),
|
||||
Path = table.Column<string>(nullable: true),
|
||||
Type = table.Column<int>(nullable: false),
|
||||
EpisodeID = table.Column<int>(nullable: false),
|
||||
IsDefault = table.Column<bool>(nullable: false),
|
||||
IsForced = table.Column<bool>(nullable: false),
|
||||
IsExternal = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tracks", x => x.ID);
|
||||
table.ForeignKey(
|
||||
name: "FK_Tracks_Episodes_EpisodeID",
|
||||
column: x => x.EpisodeID,
|
||||
principalTable: "Episodes",
|
||||
principalColumn: "ID",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionLinks_CollectionID",
|
||||
table: "CollectionLinks",
|
||||
column: "CollectionID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionLinks_ShowID",
|
||||
table: "CollectionLinks",
|
||||
column: "ShowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Collections_Slug",
|
||||
table: "Collections",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Episodes_SeasonID",
|
||||
table: "Episodes",
|
||||
column: "SeasonID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Episodes_ShowID_SeasonNumber_EpisodeNumber_AbsoluteNumber",
|
||||
table: "Episodes",
|
||||
columns: new[] { "ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GenreLinks_GenreID",
|
||||
table: "GenreLinks",
|
||||
column: "GenreID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Genres_Slug",
|
||||
table: "Genres",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Libraries_Slug",
|
||||
table: "Libraries",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_CollectionID",
|
||||
table: "LibraryLinks",
|
||||
column: "CollectionID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_LibraryID",
|
||||
table: "LibraryLinks",
|
||||
column: "LibraryID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LibraryLinks_ShowID",
|
||||
table: "LibraryLinks",
|
||||
column: "ShowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataIds_EpisodeID",
|
||||
table: "MetadataIds",
|
||||
column: "EpisodeID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataIds_PeopleID",
|
||||
table: "MetadataIds",
|
||||
column: "PeopleID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataIds_ProviderID",
|
||||
table: "MetadataIds",
|
||||
column: "ProviderID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataIds_SeasonID",
|
||||
table: "MetadataIds",
|
||||
column: "SeasonID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataIds_ShowID",
|
||||
table: "MetadataIds",
|
||||
column: "ShowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleLinks_PeopleID",
|
||||
table: "PeopleLinks",
|
||||
column: "PeopleID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PeopleLinks_ShowID",
|
||||
table: "PeopleLinks",
|
||||
column: "ShowID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Peoples_Slug",
|
||||
table: "Peoples",
|
||||
column: "Slug",
|
||||
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_Providers_Name",
|
||||
table: "Providers",
|
||||
column: "Name",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Seasons_ShowID_SeasonNumber",
|
||||
table: "Seasons",
|
||||
columns: new[] { "ShowID", "SeasonNumber" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Shows_StudioID",
|
||||
table: "Shows",
|
||||
column: "StudioID");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Studios_Slug",
|
||||
table: "Studios",
|
||||
column: "Slug",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Tracks_EpisodeID",
|
||||
table: "Tracks",
|
||||
column: "EpisodeID");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CollectionLinks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GenreLinks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "LibraryLinks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MetadataIds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PeopleLinks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProviderLinks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tracks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Genres");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Collections");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Peoples");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Libraries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Providers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Episodes");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Seasons");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Shows");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Studios");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,638 +0,0 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Kyoo;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace Kyoo.Models.DatabaseMigrations.Internal
|
||||
{
|
||||
[DbContext(typeof(DatabaseContext))]
|
||||
partial class DatabaseContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Collection", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Collections");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("CollectionLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Episode", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("AbsoluteNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EpisodeNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("ReleaseDate")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<int>("Runtime")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SeasonID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("SeasonID");
|
||||
|
||||
b.HasIndex("ShowID", "SeasonNumber", "EpisodeNumber", "AbsoluteNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Episodes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Genre", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Genres");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("GenreID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ShowID", "GenreID");
|
||||
|
||||
b.HasIndex("GenreID");
|
||||
|
||||
b.ToTable("GenreLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Library", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Paths")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Libraries");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("CollectionID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("CollectionID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("LibraryLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("DataID")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EpisodeID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Link")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("PeopleID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProviderID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SeasonID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EpisodeID");
|
||||
|
||||
b.HasIndex("PeopleID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
|
||||
b.HasIndex("SeasonID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("MetadataIds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.People", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Peoples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int>("PeopleID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Role")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Type")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("PeopleID");
|
||||
|
||||
b.HasIndex("ShowID");
|
||||
|
||||
b.ToTable("PeopleLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderID", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Logo")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Providers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<int?>("LibraryID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ProviderID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("LibraryID");
|
||||
|
||||
b.HasIndex("ProviderID");
|
||||
|
||||
b.ToTable("ProviderLinks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("ImgPrimary")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SeasonNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("ShowID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Year")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("ShowID", "SeasonNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Seasons");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Aliases")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Backdrop")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("EndYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsMovie")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Logo")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Overview")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Poster")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("StartYear")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("StudioID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TrailerUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("StudioID");
|
||||
|
||||
b.ToTable("Shows");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Studio", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Slug")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("Slug")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Studios");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Track", b =>
|
||||
{
|
||||
b.Property<int>("ID")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
b.Property<string>("Codec")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("EpisodeID")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsExternal")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsForced")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("ID");
|
||||
|
||||
b.HasIndex("EpisodeID");
|
||||
|
||||
b.ToTable("Tracks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.CollectionLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Episode", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Season", "Season")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("Episodes")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.GenreLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Genre", "Genre")
|
||||
.WithMany()
|
||||
.HasForeignKey("GenreID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("GenreLinks")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.LibraryLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Collection", "Collection")
|
||||
.WithMany()
|
||||
.HasForeignKey("CollectionID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany("Links")
|
||||
.HasForeignKey("LibraryID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.MetadataID", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Episode", "Episode")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("EpisodeID");
|
||||
|
||||
b.HasOne("Kyoo.Models.People", "People")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("PeopleID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProviderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Season", "Season")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("SeasonID");
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("ExternalIDs")
|
||||
.HasForeignKey("ShowID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.PeopleLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.People", "People")
|
||||
.WithMany("Roles")
|
||||
.HasForeignKey("PeopleID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("People")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.ProviderLink", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Library", "Library")
|
||||
.WithMany("ProviderLinks")
|
||||
.HasForeignKey("LibraryID");
|
||||
|
||||
b.HasOne("Kyoo.Models.ProviderID", "Provider")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProviderID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Season", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Show", "Show")
|
||||
.WithMany("Seasons")
|
||||
.HasForeignKey("ShowID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Show", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Studio", "Studio")
|
||||
.WithMany("Shows")
|
||||
.HasForeignKey("StudioID");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Kyoo.Models.Track", b =>
|
||||
{
|
||||
b.HasOne("Kyoo.Models.Episode", "Episode")
|
||||
.WithMany("Tracks")
|
||||
.HasForeignKey("EpisodeID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -46,9 +46,9 @@ namespace Kyoo
|
||||
services.AddDbContext<DatabaseContext>(options =>
|
||||
{
|
||||
options.UseLazyLoadingProxies()
|
||||
.UseNpgsql(_configuration.GetConnectionString("Database"))
|
||||
.EnableSensitiveDataLogging();
|
||||
// .UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
||||
.UseNpgsql(_configuration.GetConnectionString("Database"));
|
||||
//.EnableSensitiveDataLogging()
|
||||
//.UseLoggerFactory(LoggerFactory.Create(builder => builder.AddConsole()));
|
||||
}, ServiceLifetime.Transient);
|
||||
|
||||
services.AddDbContext<IdentityDatabase>(options =>
|
||||
|
@ -58,6 +58,11 @@ namespace Kyoo.Controllers
|
||||
|
||||
using IServiceScope serviceScope = _serviceProvider.CreateScope();
|
||||
await using ILibraryManager libraryManager = serviceScope.ServiceProvider.GetService<ILibraryManager>();
|
||||
|
||||
// foreach (Show show in await libraryManager.GetShows())
|
||||
// if (!Directory.Exists(show.Path))
|
||||
// await libraryManager.DeleteShow(show);
|
||||
|
||||
ICollection<Episode> episodes = await libraryManager.GetEpisodes();
|
||||
ICollection<Library> libraries = argument == null
|
||||
? await libraryManager.GetLibraries()
|
||||
@ -135,12 +140,12 @@ namespace Kyoo.Controllers
|
||||
{
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
try
|
||||
|
||||
try
|
||||
{
|
||||
using IServiceScope serviceScope = _serviceProvider.CreateScope();
|
||||
await using ILibraryManager libraryManager = serviceScope.ServiceProvider.GetService<ILibraryManager>();
|
||||
|
||||
|
||||
string patern = _config.GetValue<string>("regex");
|
||||
Regex regex = new Regex(patern, RegexOptions.IgnoreCase);
|
||||
Match match = regex.Match(relativePath);
|
||||
@ -160,12 +165,12 @@ namespace Kyoo.Controllers
|
||||
else
|
||||
{
|
||||
Season season = await GetSeason(libraryManager, show, seasonNumber, library);
|
||||
Episode episode = await GetEpisode(libraryManager,
|
||||
show,
|
||||
season,
|
||||
episodeNumber,
|
||||
Episode episode = await GetEpisode(libraryManager,
|
||||
show,
|
||||
season,
|
||||
episodeNumber,
|
||||
absoluteNumber,
|
||||
path,
|
||||
path,
|
||||
library);
|
||||
await libraryManager.RegisterEpisode(episode);
|
||||
}
|
||||
@ -173,6 +178,10 @@ namespace Kyoo.Controllers
|
||||
await libraryManager.AddShowLink(show, library, collection);
|
||||
Console.WriteLine($"Episode at {path} registered.");
|
||||
}
|
||||
catch (DuplicatedItemException ex)
|
||||
{
|
||||
await Console.Error.WriteLineAsync($"{path}: {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Console.Error.WriteLineAsync($"Unknown exception thrown while registering episode at {path}." +
|
||||
|
Loading…
x
Reference in New Issue
Block a user