diff --git a/Jellyfin.Data/DbContexts/Jellyfin.cs b/Jellyfin.Data/DbContexts/Jellyfin.cs
new file mode 100644
index 000000000..fd488ce7d
--- /dev/null
+++ b/Jellyfin.Data/DbContexts/Jellyfin.cs
@@ -0,0 +1,1140 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated from a template.
+//
+// Manual changes to this file may cause unexpected behavior in your application.
+// Manual changes to this file will be overwritten if the code is regenerated.
+//
+// Produced by Entity Framework Visual Editor
+// https://github.com/msawczyn/EFDesigner
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Jellyfin.Data.DbContexts
+{
+ ///
+ public partial class Jellyfin : DbContext
+ {
+ #region DbSets
+ public virtual Microsoft.EntityFrameworkCore.DbSet Artwork { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Books { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet BookMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Chapters { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Collections { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet CollectionItems { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Companies { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet CompanyMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet CustomItems { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet CustomItemMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Episodes { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet EpisodeMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Genres { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Groups { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Libraries { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet LibraryItems { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet LibraryRoot { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MediaFiles { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MediaFileStream { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Metadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MetadataProviders { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MetadataProviderIds { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Movies { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MovieMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MusicAlbums { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet MusicAlbumMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Permissions { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet People { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet PersonRoles { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Photo { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet PhotoMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Preferences { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet ProviderMappings { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Ratings { get; set; }
+
+ ///
+ /// Repository for global::Jellyfin.Data.Entities.RatingSource - This is the entity to
+ /// store review ratings, not age ratings
+ ///
+ public virtual Microsoft.EntityFrameworkCore.DbSet RatingSources { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Releases { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Seasons { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet SeasonMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Series { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet SeriesMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Tracks { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet TrackMetadata { get; set; }
+ public virtual Microsoft.EntityFrameworkCore.DbSet Users { get; set; }
+ #endregion DbSets
+
+ ///
+ /// Default connection string
+ ///
+ public static string ConnectionString { get; set; } = @"Data Source=jellyfin.db";
+
+ ///
+ public Jellyfin(DbContextOptions options) : base(options)
+ {
+ }
+
+ partial void CustomInit(DbContextOptionsBuilder optionsBuilder);
+
+ ///
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ CustomInit(optionsBuilder);
+ }
+
+ partial void OnModelCreatingImpl(ModelBuilder modelBuilder);
+ partial void OnModelCreatedImpl(ModelBuilder modelBuilder);
+
+ ///
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ OnModelCreatingImpl(modelBuilder);
+
+ modelBuilder.HasDefaultSchema("jellyfin");
+
+ modelBuilder.Entity()
+ .ToTable("Artwork")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Path)
+ .HasMaxLength(65535)
+ .IsRequired()
+ .HasField("_Path")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Kind)
+ .IsRequired()
+ .HasField("_Kind")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity().HasIndex(t => t.Kind);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .HasMany(x => x.BookMetadata)
+ .WithOne()
+ .HasForeignKey("BookMetadata_BookMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.ISBN)
+ .HasField("_ISBN")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Publishers)
+ .WithOne()
+ .HasForeignKey("Company_Publishers_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("Chapter")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Language)
+ .HasMaxLength(3)
+ .IsRequired()
+ .HasField("_Language")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.TimeStart)
+ .IsRequired()
+ .HasField("_TimeStart")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.TimeEnd)
+ .HasField("_TimeEnd")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .ToTable("Collection")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.CollectionItem)
+ .WithOne()
+ .HasForeignKey("CollectionItem_CollectionItem_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("CollectionItem")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.LibraryItem)
+ .WithOne()
+ .HasForeignKey("LibraryItem_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasOne(x => x.Next)
+ .WithOne()
+ .HasForeignKey("CollectionItem_Next_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasOne(x => x.Previous)
+ .WithOne()
+ .HasForeignKey("CollectionItem_Previous_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("Company")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.CompanyMetadata)
+ .WithOne()
+ .HasForeignKey("CompanyMetadata_CompanyMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasOne(x => x.Parent)
+ .WithOne()
+ .HasForeignKey("Company_Parent_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Description)
+ .HasMaxLength(65535)
+ .HasField("_Description")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Headquarters)
+ .HasMaxLength(255)
+ .HasField("_Headquarters")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Country)
+ .HasMaxLength(2)
+ .HasField("_Country")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Homepage)
+ .HasMaxLength(1024)
+ .HasField("_Homepage")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+
+ modelBuilder.Entity()
+ .HasMany(x => x.CustomItemMetadata)
+ .WithOne()
+ .HasForeignKey("CustomItemMetadata_CustomItemMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+
+
+ modelBuilder.Entity()
+ .Property(t => t.EpisodeNumber)
+ .HasField("_EpisodeNumber")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.EpisodeMetadata)
+ .WithOne()
+ .HasForeignKey("EpisodeMetadata_EpisodeMetadata_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Outline)
+ .HasMaxLength(1024)
+ .HasField("_Outline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Plot)
+ .HasMaxLength(65535)
+ .HasField("_Plot")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Tagline)
+ .HasMaxLength(1024)
+ .HasField("_Tagline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+
+ modelBuilder.Entity()
+ .ToTable("Genre")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(255)
+ .IsRequired()
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity().HasIndex(t => t.Name)
+ .IsUnique();
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .ToTable("Groups")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(255)
+ .IsRequired();
+ modelBuilder.Entity().Property("Timestamp").IsConcurrencyToken();
+ modelBuilder.Entity()
+ .HasMany(x => x.GroupPermissions)
+ .WithOne()
+ .HasForeignKey("Permission_GroupPermissions_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.ProviderMappings)
+ .WithOne()
+ .HasForeignKey("ProviderMapping_ProviderMappings_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Preferences)
+ .WithOne()
+ .HasForeignKey("Preference_Preferences_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("Library")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .IsRequired()
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .ToTable("LibraryItem")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.UrlId)
+ .IsRequired()
+ .HasField("_UrlId")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity().HasIndex(t => t.UrlId)
+ .IsUnique();
+ modelBuilder.Entity()
+ .Property(t => t.DateAdded)
+ .IsRequired()
+ .HasField("_DateAdded")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.LibraryRoot)
+ .WithOne()
+ .HasForeignKey("LibraryRoot_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("LibraryRoot")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Path)
+ .HasMaxLength(65535)
+ .IsRequired()
+ .HasField("_Path")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.NetworkPath)
+ .HasMaxLength(65535)
+ .HasField("_NetworkPath")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.Library)
+ .WithOne()
+ .HasForeignKey("Library_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("MediaFile")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Path)
+ .HasMaxLength(65535)
+ .IsRequired()
+ .HasField("_Path")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Kind)
+ .IsRequired()
+ .HasField("_Kind")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.MediaFileStreams)
+ .WithOne()
+ .HasForeignKey("MediaFileStream_MediaFileStreams_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("MediaFileStream")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.StreamNumber)
+ .IsRequired()
+ .HasField("_StreamNumber")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .ToTable("Metadata")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Title)
+ .HasMaxLength(1024)
+ .IsRequired()
+ .HasField("_Title")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.OriginalTitle)
+ .HasMaxLength(1024)
+ .HasField("_OriginalTitle")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.SortTitle)
+ .HasMaxLength(1024)
+ .HasField("_SortTitle")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Language)
+ .HasMaxLength(3)
+ .IsRequired()
+ .HasField("_Language")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.ReleaseDate)
+ .HasField("_ReleaseDate")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.DateAdded)
+ .IsRequired()
+ .HasField("_DateAdded")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.DateModified)
+ .IsRequired()
+ .HasField("_DateModified")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.PersonRoles)
+ .WithOne()
+ .HasForeignKey("PersonRole_PersonRoles_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Genres)
+ .WithOne()
+ .HasForeignKey("Genre_Genres_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Artwork)
+ .WithOne()
+ .HasForeignKey("Artwork_Artwork_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Ratings)
+ .WithOne()
+ .HasForeignKey("Rating_Ratings_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Sources)
+ .WithOne()
+ .HasForeignKey("MetadataProviderId_Sources_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("MetadataProvider")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .IsRequired()
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+
+ modelBuilder.Entity()
+ .ToTable("MetadataProviderId")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.ProviderId)
+ .HasMaxLength(255)
+ .IsRequired()
+ .HasField("_ProviderId")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.MetadataProvider)
+ .WithOne()
+ .HasForeignKey("MetadataProvider_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.MovieMetadata)
+ .WithOne()
+ .HasForeignKey("MovieMetadata_MovieMetadata_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Outline)
+ .HasMaxLength(1024)
+ .HasField("_Outline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Plot)
+ .HasMaxLength(65535)
+ .HasField("_Plot")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Tagline)
+ .HasMaxLength(1024)
+ .HasField("_Tagline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Country)
+ .HasMaxLength(2)
+ .HasField("_Country")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Studios)
+ .WithOne()
+ .HasForeignKey("Company_Studios_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .HasMany(x => x.MusicAlbumMetadata)
+ .WithOne()
+ .HasForeignKey("MusicAlbumMetadata_MusicAlbumMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Tracks)
+ .WithOne()
+ .HasForeignKey("Track_Tracks_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Barcode)
+ .HasMaxLength(255)
+ .HasField("_Barcode")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.LabelNumber)
+ .HasMaxLength(255)
+ .HasField("_LabelNumber")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Country)
+ .HasMaxLength(2)
+ .HasField("_Country")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Labels)
+ .WithOne()
+ .HasForeignKey("Company_Labels_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("Permissions")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Kind)
+ .IsRequired()
+ .HasField("_Kind")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Value)
+ .IsRequired();
+ modelBuilder.Entity().Property("Timestamp").IsConcurrencyToken();
+
+ modelBuilder.Entity()
+ .ToTable("Person")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.UrlId)
+ .IsRequired()
+ .HasField("_UrlId")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .IsRequired()
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.SourceId)
+ .HasMaxLength(255)
+ .HasField("_SourceId")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.DateAdded)
+ .IsRequired()
+ .HasField("_DateAdded")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.DateModified)
+ .IsRequired()
+ .HasField("_DateModified")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.Sources)
+ .WithOne()
+ .HasForeignKey("MetadataProviderId_Sources_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("PersonRole")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Role)
+ .HasMaxLength(1024)
+ .HasField("_Role")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Type)
+ .IsRequired()
+ .HasField("_Type")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.Person)
+ .WithOne()
+ .HasForeignKey("Person_Id")
+ .IsRequired()
+ .OnDelete(DeleteBehavior.Cascade);
+ modelBuilder.Entity()
+ .HasOne(x => x.Artwork)
+ .WithOne()
+ .HasForeignKey("Artwork_Artwork_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Sources)
+ .WithOne()
+ .HasForeignKey("MetadataProviderId_Sources_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .HasMany(x => x.PhotoMetadata)
+ .WithOne()
+ .HasForeignKey("PhotoMetadata_PhotoMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+
+
+ modelBuilder.Entity()
+ .ToTable("Preferences")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Kind)
+ .IsRequired();
+ modelBuilder.Entity()
+ .Property(t => t.Value)
+ .HasMaxLength(65535)
+ .IsRequired();
+ modelBuilder.Entity().Property("Timestamp").IsConcurrencyToken();
+
+ modelBuilder.Entity()
+ .ToTable("ProviderMappings")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.ProviderName)
+ .HasMaxLength(255)
+ .IsRequired();
+ modelBuilder.Entity()
+ .Property(t => t.ProviderSecrets)
+ .HasMaxLength(65535)
+ .IsRequired();
+ modelBuilder.Entity()
+ .Property(t => t.ProviderData)
+ .HasMaxLength(65535)
+ .IsRequired();
+ modelBuilder.Entity().Property("Timestamp").IsConcurrencyToken();
+
+ modelBuilder.Entity()
+ .ToTable("Rating")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Value)
+ .IsRequired()
+ .HasField("_Value")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Votes)
+ .HasField("_Votes")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.RatingType)
+ .WithOne()
+ .HasForeignKey("RatingSource_RatingType_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("RatingType")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.MaximumValue)
+ .IsRequired()
+ .HasField("_MaximumValue")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.MinimumValue)
+ .IsRequired()
+ .HasField("_MinimumValue")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasOne(x => x.Source)
+ .WithOne()
+ .HasForeignKey("MetadataProviderId_Source_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .ToTable("Release")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .HasField("_Id")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.Name)
+ .HasMaxLength(1024)
+ .IsRequired()
+ .HasField("_Name")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Timestamp)
+ .IsRequired()
+ .HasField("_Timestamp")
+ .UsePropertyAccessMode(PropertyAccessMode.Property)
+ .IsRowVersion();
+ modelBuilder.Entity()
+ .HasMany(x => x.MediaFiles)
+ .WithOne()
+ .HasForeignKey("MediaFile_MediaFiles_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Chapters)
+ .WithOne()
+ .HasForeignKey("Chapter_Chapters_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.SeasonNumber)
+ .HasField("_SeasonNumber")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.SeasonMetadata)
+ .WithOne()
+ .HasForeignKey("SeasonMetadata_SeasonMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Episodes)
+ .WithOne()
+ .HasForeignKey("Episode_Episodes_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Outline)
+ .HasMaxLength(1024)
+ .HasField("_Outline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+
+ modelBuilder.Entity()
+ .Property(t => t.AirsDayOfWeek)
+ .HasField("_AirsDayOfWeek")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.AirsTime)
+ .HasField("_AirsTime")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.FirstAired)
+ .HasField("_FirstAired")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.SeriesMetadata)
+ .WithOne()
+ .HasForeignKey("SeriesMetadata_SeriesMetadata_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.Seasons)
+ .WithOne()
+ .HasForeignKey("Season_Seasons_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.Outline)
+ .HasMaxLength(1024)
+ .HasField("_Outline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Plot)
+ .HasMaxLength(65535)
+ .HasField("_Plot")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Tagline)
+ .HasMaxLength(1024)
+ .HasField("_Tagline")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .Property(t => t.Country)
+ .HasMaxLength(2)
+ .HasField("_Country")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Networks)
+ .WithOne()
+ .HasForeignKey("Company_Networks_Id")
+ .IsRequired();
+
+ modelBuilder.Entity()
+ .Property(t => t.TrackNumber)
+ .HasField("_TrackNumber")
+ .UsePropertyAccessMode(PropertyAccessMode.Property);
+ modelBuilder.Entity()
+ .HasMany(x => x.Releases)
+ .WithOne()
+ .HasForeignKey("Release_Releases_Id")
+ .IsRequired();
+ modelBuilder.Entity()
+ .HasMany(x => x.TrackMetadata)
+ .WithOne()
+ .HasForeignKey("TrackMetadata_TrackMetadata_Id")
+ .IsRequired();
+
+
+ modelBuilder.Entity()
+ .ToTable("Users")
+ .HasKey(t => t.Id);
+ modelBuilder.Entity()
+ .Property(t => t.Id)
+ .IsRequired()
+ .ValueGeneratedOnAdd();
+ modelBuilder.Entity()
+ .Property(t => t.LastLoginTimestamp)
+ .IsRequired()
+ .IsRowVersion();
+ modelBuilder.Entity