The Free Software Media System - Server Backend & API
Added EF BaseItem migration
JPVensonc2844bda3b76
diff --git a/Jellyfin.Data/Entities/AncestorId.cs b/Jellyfin.Data/Entities/AncestorId.csindex 3839b1ae46..54e938347b 100644--- a/Jellyfin.Data/Entities/AncestorId.cs+++ b/Jellyfin.Data/Entities/AncestorId.cs@@ -11,7 +11,7 @@ public class AncestorId{public Guid Id { get; set; }- public Guid ItemId { get; set; }+ public required Guid ItemId { get; set; }public required BaseItemEntity Item { get; set; }diff --git a/Jellyfin.Data/Entities/BaseItemEntity.cs b/Jellyfin.Data/Entities/BaseItemEntity.csindex 1b8a6b553b..5348c8746e 100644--- a/Jellyfin.Data/Entities/BaseItemEntity.cs+++ b/Jellyfin.Data/Entities/BaseItemEntity.cs@@ -6,6 +6,8 @@ using System.ComponentModel.DataAnnotations.Schema;namespace Jellyfin.Data.Entities;#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member+#pragma warning disable CA2227 // Collection properties should be read only+public class BaseItemEntity{[DatabaseGenerated(DatabaseGeneratedOption.Identity)]@@ -156,19 +158,26 @@ public class BaseItemEntitypublic BaseItemEntity? Parent { get; set; }+ public ICollection<BaseItemEntity>? DirectChildren { get; set; }+public Guid? TopParentId { get; set; }public BaseItemEntity? TopParent { get; set; }+ public ICollection<BaseItemEntity>? AllChildren { get; set; }+public Guid? SeasonId { get; set; }public BaseItemEntity? Season { get; set; }+ public ICollection<BaseItemEntity>? SeasonEpisodes { get; set; }+public Guid? SeriesId { get; set; }+ public ICollection<BaseItemEntity>? SeriesEpisodes { get; set; }+public BaseItemEntity? Series { get; set; }-#pragma warning disable CA2227 // Collection properties should be read onlypublic ICollection<People>? Peoples { get; set; }public ICollection<UserData>? UserData { get; set; }diff --git a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs b/Jellyfin.Server.Implementations/Item/BaseItemRepository.csindex a3e617a211..d5a1be6792 100644--- a/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs+++ b/Jellyfin.Server.Implementations/Item/BaseItemRepository.cs@@ -1259,7 +1259,8 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPr{Item = entity,AncestorIdText = ancestorId.ToString(),- Id = ancestorId+ Id = ancestorId,+ ItemId = entity.Id});}}@@ -1273,7 +1274,8 @@ public sealed class BaseItemRepository(IDbContextFactory<JellyfinDbContext> dbPrItem = entity,Type = itemValue.MagicNumber,Value = itemValue.Value,- CleanValue = GetCleanValue(itemValue.Value)+ CleanValue = GetCleanValue(itemValue.Value),+ ItemId = entity.Id});}}diff --git a/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.Designer.cs b/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.Designer.csnew file mode 100644index 0000000000..b3e028298f--- /dev/null+++ b/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.Designer.cs@@ -0,0 +1,1484 @@+// <auto-generated />+using System;+using Jellyfin.Server.Implementations;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Infrastructure;+using Microsoft.EntityFrameworkCore.Migrations;+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;++#nullable disable++namespace Jellyfin.Server.Implementations.Migrations+{+ [DbContext(typeof(JellyfinDbContext))]+ [Migration("20241009112234_BaseItemRefactor")]+ partial class BaseItemRefactor+ {+ /// <inheritdoc />+ protected override void BuildTargetModel(ModelBuilder modelBuilder)+ {+#pragma warning disable 612, 618+ modelBuilder.HasAnnotation("ProductVersion", "8.0.8");++ modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DayOfWeek")+ .HasColumnType("INTEGER");++ b.Property<double>("EndHour")+ .HasColumnType("REAL");++ b.Property<double>("StartHour")+ .HasColumnType("REAL");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("AccessSchedules");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ActivityLog", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<string>("ItemId")+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<int>("LogSeverity")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("ShortOverview")+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<string>("Type")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DateCreated");++ b.ToTable("ActivityLogs");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("AncestorIdText")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Id");++ b.HasIndex("Id");++ b.HasIndex("ItemId", "AncestorIdText");++ b.ToTable("AncestorIds");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Index")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<string>("Filename")+ .HasColumnType("TEXT");++ b.Property<string>("MimeType")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Index");++ b.ToTable("AttachmentStreamInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Album")+ .HasColumnType("TEXT");++ b.Property<string>("AlbumArtists")+ .HasColumnType("TEXT");++ b.Property<string>("Artists")+ .HasColumnType("TEXT");++ b.Property<string>("Audio")+ .HasColumnType("TEXT");++ b.Property<string>("ChannelId")+ .HasColumnType("TEXT");++ b.Property<string>("CleanName")+ .HasColumnType("TEXT");++ b.Property<float?>("CommunityRating")+ .HasColumnType("REAL");++ b.Property<float?>("CriticRating")+ .HasColumnType("REAL");++ b.Property<string>("CustomRating")+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastMediaAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastRefreshed")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastSaved")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("EndDate")+ .HasColumnType("TEXT");++ b.Property<string>("EpisodeTitle")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalSeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalServiceId")+ .HasColumnType("TEXT");++ b.Property<string>("ExtraIds")+ .HasColumnType("TEXT");++ b.Property<string>("ExtraType")+ .HasColumnType("TEXT");++ b.Property<string>("ForcedSortName")+ .HasColumnType("TEXT");++ b.Property<string>("Genres")+ .HasColumnType("TEXT");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<string>("Images")+ .HasColumnType("TEXT");++ b.Property<int?>("IndexNumber")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingValue")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInMixedFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsLocked")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsMovie")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsRepeat")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsSeries")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsVirtualItem")+ .HasColumnType("INTEGER");++ b.Property<float?>("LUFS")+ .HasColumnType("REAL");++ b.Property<string>("LockedFields")+ .HasColumnType("TEXT");++ b.Property<string>("MediaType")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<float?>("NormalizationGain")+ .HasColumnType("REAL");++ b.Property<string>("OfficialRating")+ .HasColumnType("TEXT");++ b.Property<string>("OriginalTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasColumnType("TEXT");++ b.Property<string>("OwnerId")+ .HasColumnType("TEXT");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("ParentIndexNumber")+ .HasColumnType("INTEGER");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataCountryCode")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataLanguage")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("PremiereDate")+ .HasColumnType("TEXT");++ b.Property<string>("PresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("PrimaryVersionId")+ .HasColumnType("TEXT");++ b.Property<string>("ProductionLocations")+ .HasColumnType("TEXT");++ b.Property<int?>("ProductionYear")+ .HasColumnType("INTEGER");++ b.Property<long?>("RunTimeTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("SeasonId")+ .HasColumnType("TEXT");++ b.Property<string>("SeasonName")+ .HasColumnType("TEXT");++ b.Property<Guid?>("SeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesName")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesPresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("ShowId")+ .HasColumnType("TEXT");++ b.Property<long?>("Size")+ .HasColumnType("INTEGER");++ b.Property<string>("SortName")+ .HasColumnType("TEXT");++ b.Property<DateTime>("StartDate")+ .HasColumnType("TEXT");++ b.Property<string>("Studios")+ .HasColumnType("TEXT");++ b.Property<string>("Tagline")+ .HasColumnType("TEXT");++ b.Property<string>("Tags")+ .HasColumnType("TEXT");++ b.Property<Guid?>("TopParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("TotalBitrate")+ .HasColumnType("INTEGER");++ b.Property<string>("TrailerTypes")+ .HasColumnType("TEXT");++ b.Property<string>("Type")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("UnratedType")+ .HasColumnType("TEXT");++ b.Property<string>("UserDataKey")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ParentId");++ b.HasIndex("Path");++ b.HasIndex("PresentationUniqueKey");++ b.HasIndex("SeasonId");++ b.HasIndex("SeriesId");++ b.HasIndex("TopParentId", "Id");++ b.HasIndex("UserDataKey", "Type");++ b.HasIndex("Type", "TopParentId", "Id");++ b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");++ b.HasIndex("Type", "TopParentId", "StartDate");++ b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem");++ b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName");++ b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.ToTable("BaseItems");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ProviderId");++ b.HasIndex("ProviderId", "ProviderValue", "ItemId");++ b.ToTable("BaseItemProviders");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ChapterIndex")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("ImageDateModified")+ .HasColumnType("TEXT");++ b.Property<string>("ImagePath")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<long>("StartPositionTicks")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "ChapterIndex");++ b.ToTable("Chapters");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Key")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client", "Key")+ .IsUnique();++ b.ToTable("CustomItemDisplayPreferences");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("ChromecastVersion")+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<string>("DashboardTheme")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("EnableNextVideoInfoOverlay")+ .HasColumnType("INTEGER");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ScrollDirection")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowBackdrop")+ .HasColumnType("INTEGER");++ b.Property<bool>("ShowSidebar")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipBackwardLength")+ .HasColumnType("INTEGER");++ b.Property<int>("SkipForwardLength")+ .HasColumnType("INTEGER");++ b.Property<string>("TvHome")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "ItemId", "Client")+ .IsUnique();++ b.ToTable("DisplayPreferences");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("DisplayPreferencesId")+ .HasColumnType("INTEGER");++ b.Property<int>("Order")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("DisplayPreferencesId");++ b.ToTable("HomeSection");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<DateTime>("LastModified")+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .IsRequired()+ .HasMaxLength(512)+ .HasColumnType("TEXT");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId")+ .IsUnique();++ b.ToTable("ImageInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("Client")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<int?>("IndexBy")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<bool>("RememberIndexing")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSorting")+ .HasColumnType("INTEGER");++ b.Property<string>("SortBy")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<int>("SortOrder")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<int>("ViewType")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId");++ b.ToTable("ItemDisplayPreferences");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.Property<string>("CleanValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Type", "Value");++ b.HasIndex("ItemId", "Type", "CleanValue");++ b.ToTable("ItemValues");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<long>("EndTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("SegmentProviderId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<long>("StartTicks")+ .HasColumnType("INTEGER");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.ToTable("MediaSegments");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("StreamIndex")+ .HasColumnType("INTEGER");++ b.Property<string>("AspectRatio")+ .HasColumnType("TEXT");++ b.Property<float>("AverageFrameRate")+ .HasColumnType("REAL");++ b.Property<int>("BitDepth")+ .HasColumnType("INTEGER");++ b.Property<int>("BitRate")+ .HasColumnType("INTEGER");++ b.Property<int>("BlPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<string>("ChannelLayout")+ .HasColumnType("TEXT");++ b.Property<int>("Channels")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("CodecTimeBase")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorPrimaries")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorSpace")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorTransfer")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("DvBlSignalCompatibilityId")+ .HasColumnType("INTEGER");++ b.Property<int>("DvLevel")+ .HasColumnType("INTEGER");++ b.Property<int>("DvProfile")+ .HasColumnType("INTEGER");++ b.Property<int>("DvVersionMajor")+ .HasColumnType("INTEGER");++ b.Property<int>("DvVersionMinor")+ .HasColumnType("INTEGER");++ b.Property<int>("ElPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsAnamorphic")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsAvc")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsExternal")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsForced")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsHearingImpaired")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInterlaced")+ .HasColumnType("INTEGER");++ b.Property<string>("KeyFrames")+ .HasColumnType("TEXT");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<float>("Level")+ .HasColumnType("REAL");++ b.Property<string>("NalLengthSize")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PixelFormat")+ .HasColumnType("TEXT");++ b.Property<string>("Profile")+ .HasColumnType("TEXT");++ b.Property<float>("RealFrameRate")+ .HasColumnType("REAL");++ b.Property<int>("RefFrames")+ .HasColumnType("INTEGER");++ b.Property<int>("Rotation")+ .HasColumnType("INTEGER");++ b.Property<int>("RpuPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int>("SampleRate")+ .HasColumnType("INTEGER");++ b.Property<string>("StreamType")+ .HasColumnType("TEXT");++ b.Property<string>("TimeBase")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "StreamIndex");++ b.HasIndex("StreamIndex");++ b.HasIndex("StreamType");++ b.HasIndex("StreamIndex", "StreamType");++ b.HasIndex("StreamIndex", "StreamType", "Language");++ b.ToTable("MediaStreamInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.People", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Role")+ .HasColumnType("TEXT");++ b.Property<int?>("ListOrder")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("PersonType")+ .HasColumnType("TEXT");++ b.Property<int?>("SortOrder")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "Role", "ListOrder");++ b.HasIndex("Name");++ b.HasIndex("ItemId", "ListOrder");++ b.ToTable("Peoples");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Permission_Permissions_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<bool>("Value")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Permissions");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<int>("Kind")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("Preference_Preferences_Guid")+ .HasColumnType("TEXT");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<Guid?>("UserId")+ .HasColumnType("TEXT");++ b.Property<string>("Value")+ .IsRequired()+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("UserId", "Kind")+ .IsUnique()+ .HasFilter("[UserId] IS NOT NULL");++ b.ToTable("Preferences");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Security.ApiKey", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("AccessToken")+ .IsUnique();++ b.ToTable("ApiKeys");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("AccessToken")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("AppName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<string>("AppVersion")+ .IsRequired()+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateLastActivity")+ .HasColumnType("TEXT");++ b.Property<DateTime>("DateModified")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasMaxLength(256)+ .HasColumnType("TEXT");++ b.Property<string>("DeviceName")+ .IsRequired()+ .HasMaxLength(64)+ .HasColumnType("TEXT");++ b.Property<bool>("IsActive")+ .HasColumnType("INTEGER");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DeviceId");++ b.HasIndex("AccessToken", "DateLastActivity");++ b.HasIndex("DeviceId", "DateLastActivity");++ b.HasIndex("UserId", "DeviceId");++ b.ToTable("Devices");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Security.DeviceOptions", b =>+ {+ b.Property<int>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("INTEGER");++ b.Property<string>("CustomName")+ .HasColumnType("TEXT");++ b.Property<string>("DeviceId")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("Id");++ b.HasIndex("DeviceId")+ .IsUnique();++ b.ToTable("DeviceOptions");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.TrickplayInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.Property<int>("Bandwidth")+ .HasColumnType("INTEGER");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<int>("Interval")+ .HasColumnType("INTEGER");++ b.Property<int>("ThumbnailCount")+ .HasColumnType("INTEGER");++ b.Property<int>("TileHeight")+ .HasColumnType("INTEGER");++ b.Property<int>("TileWidth")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "Width");++ b.ToTable("TrickplayInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("AudioLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("AuthenticationProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<string>("CastReceiverId")+ .HasMaxLength(32)+ .HasColumnType("TEXT");++ b.Property<bool>("DisplayCollectionsView")+ .HasColumnType("INTEGER");++ b.Property<bool>("DisplayMissingEpisodes")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableAutoLogin")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableLocalPassword")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableNextEpisodeAutoPlay")+ .HasColumnType("INTEGER");++ b.Property<bool>("EnableUserPreferenceAccess")+ .HasColumnType("INTEGER");++ b.Property<bool>("HidePlayedInLatest")+ .HasColumnType("INTEGER");++ b.Property<long>("InternalId")+ .HasColumnType("INTEGER");++ b.Property<int>("InvalidLoginAttemptCount")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastActivityDate")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("LastLoginDate")+ .HasColumnType("TEXT");++ b.Property<int?>("LoginAttemptsBeforeLockout")+ .HasColumnType("INTEGER");++ b.Property<int>("MaxActiveSessions")+ .HasColumnType("INTEGER");++ b.Property<int?>("MaxParentalAgeRating")+ .HasColumnType("INTEGER");++ b.Property<bool>("MustUpdatePassword")+ .HasColumnType("INTEGER");++ b.Property<string>("Password")+ .HasMaxLength(65535)+ .HasColumnType("TEXT");++ b.Property<string>("PasswordResetProviderId")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<bool>("PlayDefaultAudioTrack")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberAudioSelections")+ .HasColumnType("INTEGER");++ b.Property<bool>("RememberSubtitleSelections")+ .HasColumnType("INTEGER");++ b.Property<int?>("RemoteClientBitrateLimit")+ .HasColumnType("INTEGER");++ b.Property<uint>("RowVersion")+ .IsConcurrencyToken()+ .HasColumnType("INTEGER");++ b.Property<string>("SubtitleLanguagePreference")+ .HasMaxLength(255)+ .HasColumnType("TEXT");++ b.Property<int>("SubtitleMode")+ .HasColumnType("INTEGER");++ b.Property<int>("SyncPlayAccess")+ .HasColumnType("INTEGER");++ b.Property<string>("Username")+ .IsRequired()+ .HasMaxLength(255)+ .HasColumnType("TEXT")+ .UseCollation("NOCASE");++ b.HasKey("Id");++ b.HasIndex("Username")+ .IsUnique();++ b.ToTable("Users");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b =>+ {+ b.Property<string>("Key")+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");++ b.Property<int?>("AudioStreamIndex")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("BaseItemEntityId")+ .HasColumnType("TEXT");++ b.Property<bool>("IsFavorite")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("LastPlayedDate")+ .HasColumnType("TEXT");++ b.Property<bool?>("Likes")+ .HasColumnType("INTEGER");++ b.Property<int>("PlayCount")+ .HasColumnType("INTEGER");++ b.Property<long>("PlaybackPositionTicks")+ .HasColumnType("INTEGER");++ b.Property<bool>("Played")+ .HasColumnType("INTEGER");++ b.Property<double?>("Rating")+ .HasColumnType("REAL");++ b.Property<int?>("SubtitleStreamIndex")+ .HasColumnType("INTEGER");++ b.HasKey("Key", "UserId");++ b.HasIndex("BaseItemEntityId");++ b.HasIndex("UserId");++ b.HasIndex("Key", "UserId", "IsFavorite");++ b.HasIndex("Key", "UserId", "LastPlayedDate");++ b.HasIndex("Key", "UserId", "PlaybackPositionTicks");++ b.HasIndex("Key", "UserId", "Played");++ b.ToTable("UserData");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AccessSchedule", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithMany("AccessSchedules")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("AncestorIds")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Parent")+ .WithMany("DirectChildren")+ .HasForeignKey("ParentId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Season")+ .WithMany("SeasonEpisodes")+ .HasForeignKey("SeasonId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Series")+ .WithMany("SeriesEpisodes")+ .HasForeignKey("SeriesId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "TopParent")+ .WithMany("AllChildren")+ .HasForeignKey("TopParentId");++ b.Navigation("Parent");++ b.Navigation("Season");++ b.Navigation("Series");++ b.Navigation("TopParent");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Provider")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Chapters")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithMany("DisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.HomeSection", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.DisplayPreferences", null)+ .WithMany("HomeSections")+ .HasForeignKey("DisplayPreferencesId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ImageInfo", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithOne("ProfileImage")+ .HasForeignKey("Jellyfin.Data.Entities.ImageInfo", "UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ItemDisplayPreferences", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithMany("ItemDisplayPreferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("ItemValues")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("MediaStreams")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.People", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Peoples")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithMany("Permissions")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Preference", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", null)+ .WithMany("Preferences")+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade);+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Security.Device", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.UserData", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null)+ .WithMany("UserData")+ .HasForeignKey("BaseItemEntityId");++ b.HasOne("Jellyfin.Data.Entities.User", "User")+ .WithMany()+ .HasForeignKey("UserId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("User");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.Navigation("AllChildren");++ b.Navigation("AncestorIds");++ b.Navigation("Chapters");++ b.Navigation("DirectChildren");++ b.Navigation("ItemValues");++ b.Navigation("MediaStreams");++ b.Navigation("Peoples");++ b.Navigation("Provider");++ b.Navigation("SeasonEpisodes");++ b.Navigation("SeriesEpisodes");++ b.Navigation("UserData");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>+ {+ b.Navigation("HomeSections");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.User", b =>+ {+ b.Navigation("AccessSchedules");++ b.Navigation("DisplayPreferences");++ b.Navigation("ItemDisplayPreferences");++ b.Navigation("Permissions");++ b.Navigation("Preferences");++ b.Navigation("ProfileImage");+ });+#pragma warning restore 612, 618+ }+ }+}diff --git a/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.cs b/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.csnew file mode 100644index 0000000000..f51e385e03--- /dev/null+++ b/Jellyfin.Server.Implementations/Migrations/20241009112234_BaseItemRefactor.cs@@ -0,0 +1,514 @@+using System;+using Microsoft.EntityFrameworkCore.Migrations;++#nullable disable++namespace Jellyfin.Server.Implementations.Migrations+{+ /// <inheritdoc />+ public partial class BaseItemRefactor : Migration+ {+ /// <inheritdoc />+ protected override void Up(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropIndex(+ name: "IX_UserData_Key_UserId",+ table: "UserData");++ migrationBuilder.AddColumn<Guid>(+ name: "BaseItemEntityId",+ table: "UserData",+ type: "TEXT",+ nullable: true);++ migrationBuilder.AddPrimaryKey(+ name: "PK_UserData",+ table: "UserData",+ columns: new[] { "Key", "UserId" });++ migrationBuilder.CreateTable(+ name: "BaseItems",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "TEXT", nullable: false),+ Type = table.Column<string>(type: "TEXT", nullable: false),+ Data = table.Column<string>(type: "TEXT", nullable: true),+ Path = table.Column<string>(type: "TEXT", nullable: true),+ StartDate = table.Column<DateTime>(type: "TEXT", nullable: false),+ EndDate = table.Column<DateTime>(type: "TEXT", nullable: false),+ ChannelId = table.Column<string>(type: "TEXT", nullable: true),+ IsMovie = table.Column<bool>(type: "INTEGER", nullable: false),+ CommunityRating = table.Column<float>(type: "REAL", nullable: true),+ CustomRating = table.Column<string>(type: "TEXT", nullable: true),+ IndexNumber = table.Column<int>(type: "INTEGER", nullable: true),+ IsLocked = table.Column<bool>(type: "INTEGER", nullable: false),+ Name = table.Column<string>(type: "TEXT", nullable: true),+ OfficialRating = table.Column<string>(type: "TEXT", nullable: true),+ MediaType = table.Column<string>(type: "TEXT", nullable: true),+ Overview = table.Column<string>(type: "TEXT", nullable: true),+ ParentIndexNumber = table.Column<int>(type: "INTEGER", nullable: true),+ PremiereDate = table.Column<DateTime>(type: "TEXT", nullable: true),+ ProductionYear = table.Column<int>(type: "INTEGER", nullable: true),+ Genres = table.Column<string>(type: "TEXT", nullable: true),+ SortName = table.Column<string>(type: "TEXT", nullable: true),+ ForcedSortName = table.Column<string>(type: "TEXT", nullable: true),+ RunTimeTicks = table.Column<long>(type: "INTEGER", nullable: true),+ DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),+ DateModified = table.Column<DateTime>(type: "TEXT", nullable: true),+ IsSeries = table.Column<bool>(type: "INTEGER", nullable: false),+ EpisodeTitle = table.Column<string>(type: "TEXT", nullable: true),+ IsRepeat = table.Column<bool>(type: "INTEGER", nullable: false),+ PreferredMetadataLanguage = table.Column<string>(type: "TEXT", nullable: true),+ PreferredMetadataCountryCode = table.Column<string>(type: "TEXT", nullable: true),+ DateLastRefreshed = table.Column<DateTime>(type: "TEXT", nullable: true),+ DateLastSaved = table.Column<DateTime>(type: "TEXT", nullable: true),+ IsInMixedFolder = table.Column<bool>(type: "INTEGER", nullable: false),+ LockedFields = table.Column<string>(type: "TEXT", nullable: true),+ Studios = table.Column<string>(type: "TEXT", nullable: true),+ Audio = table.Column<string>(type: "TEXT", nullable: true),+ ExternalServiceId = table.Column<string>(type: "TEXT", nullable: true),+ Tags = table.Column<string>(type: "TEXT", nullable: true),+ IsFolder = table.Column<bool>(type: "INTEGER", nullable: false),+ InheritedParentalRatingValue = table.Column<int>(type: "INTEGER", nullable: true),+ UnratedType = table.Column<string>(type: "TEXT", nullable: true),+ TrailerTypes = table.Column<string>(type: "TEXT", nullable: true),+ CriticRating = table.Column<float>(type: "REAL", nullable: true),+ CleanName = table.Column<string>(type: "TEXT", nullable: true),+ PresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true),+ OriginalTitle = table.Column<string>(type: "TEXT", nullable: true),+ PrimaryVersionId = table.Column<string>(type: "TEXT", nullable: true),+ DateLastMediaAdded = table.Column<DateTime>(type: "TEXT", nullable: true),+ Album = table.Column<string>(type: "TEXT", nullable: true),+ LUFS = table.Column<float>(type: "REAL", nullable: true),+ NormalizationGain = table.Column<float>(type: "REAL", nullable: true),+ IsVirtualItem = table.Column<bool>(type: "INTEGER", nullable: false),+ SeriesName = table.Column<string>(type: "TEXT", nullable: true),+ UserDataKey = table.Column<string>(type: "TEXT", nullable: true),+ SeasonName = table.Column<string>(type: "TEXT", nullable: true),+ ExternalSeriesId = table.Column<string>(type: "TEXT", nullable: true),+ Tagline = table.Column<string>(type: "TEXT", nullable: true),+ Images = table.Column<string>(type: "TEXT", nullable: true),+ ProductionLocations = table.Column<string>(type: "TEXT", nullable: true),+ ExtraIds = table.Column<string>(type: "TEXT", nullable: true),+ TotalBitrate = table.Column<int>(type: "INTEGER", nullable: true),+ ExtraType = table.Column<string>(type: "TEXT", nullable: true),+ Artists = table.Column<string>(type: "TEXT", nullable: true),+ AlbumArtists = table.Column<string>(type: "TEXT", nullable: true),+ ExternalId = table.Column<string>(type: "TEXT", nullable: true),+ SeriesPresentationUniqueKey = table.Column<string>(type: "TEXT", nullable: true),+ ShowId = table.Column<string>(type: "TEXT", nullable: true),+ OwnerId = table.Column<string>(type: "TEXT", nullable: true),+ Width = table.Column<int>(type: "INTEGER", nullable: true),+ Height = table.Column<int>(type: "INTEGER", nullable: true),+ Size = table.Column<long>(type: "INTEGER", nullable: true),+ ParentId = table.Column<Guid>(type: "TEXT", nullable: true),+ TopParentId = table.Column<Guid>(type: "TEXT", nullable: true),+ SeasonId = table.Column<Guid>(type: "TEXT", nullable: true),+ SeriesId = table.Column<Guid>(type: "TEXT", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_BaseItems", x => x.Id);+ table.ForeignKey(+ name: "FK_BaseItems_BaseItems_ParentId",+ column: x => x.ParentId,+ principalTable: "BaseItems",+ principalColumn: "Id");+ table.ForeignKey(+ name: "FK_BaseItems_BaseItems_SeasonId",+ column: x => x.SeasonId,+ principalTable: "BaseItems",+ principalColumn: "Id");+ table.ForeignKey(+ name: "FK_BaseItems_BaseItems_SeriesId",+ column: x => x.SeriesId,+ principalTable: "BaseItems",+ principalColumn: "Id");+ table.ForeignKey(+ name: "FK_BaseItems_BaseItems_TopParentId",+ column: x => x.TopParentId,+ principalTable: "BaseItems",+ principalColumn: "Id");+ });++ migrationBuilder.CreateTable(+ name: "AncestorIds",+ columns: table => new+ {+ Id = table.Column<Guid>(type: "TEXT", nullable: false),+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ AncestorIdText = table.Column<string>(type: "TEXT", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_AncestorIds", x => new { x.ItemId, x.Id });+ table.ForeignKey(+ name: "FK_AncestorIds_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "AttachmentStreamInfos",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ Index = table.Column<int>(type: "INTEGER", nullable: false),+ Codec = table.Column<string>(type: "TEXT", nullable: false),+ CodecTag = table.Column<string>(type: "TEXT", nullable: true),+ Comment = table.Column<string>(type: "TEXT", nullable: true),+ Filename = table.Column<string>(type: "TEXT", nullable: true),+ MimeType = table.Column<string>(type: "TEXT", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_AttachmentStreamInfos", x => new { x.ItemId, x.Index });+ table.ForeignKey(+ name: "FK_AttachmentStreamInfos_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "BaseItemProviders",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ ProviderId = table.Column<string>(type: "TEXT", nullable: false),+ ProviderValue = table.Column<string>(type: "TEXT", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_BaseItemProviders", x => new { x.ItemId, x.ProviderId });+ table.ForeignKey(+ name: "FK_BaseItemProviders_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "Chapters",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ ChapterIndex = table.Column<int>(type: "INTEGER", nullable: false),+ StartPositionTicks = table.Column<long>(type: "INTEGER", nullable: false),+ Name = table.Column<string>(type: "TEXT", nullable: true),+ ImagePath = table.Column<string>(type: "TEXT", nullable: true),+ ImageDateModified = table.Column<DateTime>(type: "TEXT", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_Chapters", x => new { x.ItemId, x.ChapterIndex });+ table.ForeignKey(+ name: "FK_Chapters_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "ItemValues",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ Type = table.Column<int>(type: "INTEGER", nullable: false),+ Value = table.Column<string>(type: "TEXT", nullable: false),+ CleanValue = table.Column<string>(type: "TEXT", nullable: false)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_ItemValues", x => new { x.ItemId, x.Type, x.Value });+ table.ForeignKey(+ name: "FK_ItemValues_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "MediaStreamInfos",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ StreamIndex = table.Column<int>(type: "INTEGER", nullable: false),+ StreamType = table.Column<string>(type: "TEXT", nullable: true),+ Codec = table.Column<string>(type: "TEXT", nullable: true),+ Language = table.Column<string>(type: "TEXT", nullable: true),+ ChannelLayout = table.Column<string>(type: "TEXT", nullable: true),+ Profile = table.Column<string>(type: "TEXT", nullable: true),+ AspectRatio = table.Column<string>(type: "TEXT", nullable: true),+ Path = table.Column<string>(type: "TEXT", nullable: true),+ IsInterlaced = table.Column<bool>(type: "INTEGER", nullable: false),+ BitRate = table.Column<int>(type: "INTEGER", nullable: false),+ Channels = table.Column<int>(type: "INTEGER", nullable: false),+ SampleRate = 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),+ Height = table.Column<int>(type: "INTEGER", nullable: false),+ Width = table.Column<int>(type: "INTEGER", nullable: false),+ AverageFrameRate = table.Column<float>(type: "REAL", nullable: false),+ RealFrameRate = table.Column<float>(type: "REAL", nullable: false),+ Level = table.Column<float>(type: "REAL", nullable: false),+ PixelFormat = table.Column<string>(type: "TEXT", nullable: true),+ BitDepth = table.Column<int>(type: "INTEGER", nullable: false),+ IsAnamorphic = table.Column<bool>(type: "INTEGER", nullable: false),+ RefFrames = table.Column<int>(type: "INTEGER", nullable: false),+ CodecTag = table.Column<string>(type: "TEXT", nullable: false),+ Comment = table.Column<string>(type: "TEXT", nullable: false),+ NalLengthSize = table.Column<string>(type: "TEXT", nullable: false),+ IsAvc = table.Column<bool>(type: "INTEGER", nullable: false),+ Title = table.Column<string>(type: "TEXT", nullable: false),+ TimeBase = table.Column<string>(type: "TEXT", nullable: false),+ CodecTimeBase = table.Column<string>(type: "TEXT", nullable: false),+ ColorPrimaries = table.Column<string>(type: "TEXT", nullable: false),+ ColorSpace = table.Column<string>(type: "TEXT", nullable: false),+ ColorTransfer = table.Column<string>(type: "TEXT", nullable: false),+ DvVersionMajor = table.Column<int>(type: "INTEGER", nullable: false),+ DvVersionMinor = table.Column<int>(type: "INTEGER", nullable: false),+ DvProfile = table.Column<int>(type: "INTEGER", nullable: false),+ DvLevel = table.Column<int>(type: "INTEGER", nullable: false),+ RpuPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),+ ElPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),+ BlPresentFlag = table.Column<int>(type: "INTEGER", nullable: false),+ DvBlSignalCompatibilityId = table.Column<int>(type: "INTEGER", nullable: false),+ IsHearingImpaired = table.Column<bool>(type: "INTEGER", nullable: false),+ Rotation = table.Column<int>(type: "INTEGER", nullable: false),+ KeyFrames = table.Column<string>(type: "TEXT", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_MediaStreamInfos", x => new { x.ItemId, x.StreamIndex });+ table.ForeignKey(+ name: "FK_MediaStreamInfos_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateTable(+ name: "Peoples",+ columns: table => new+ {+ ItemId = table.Column<Guid>(type: "TEXT", nullable: false),+ Role = table.Column<string>(type: "TEXT", nullable: false),+ ListOrder = table.Column<int>(type: "INTEGER", nullable: false),+ Name = table.Column<string>(type: "TEXT", nullable: false),+ PersonType = table.Column<string>(type: "TEXT", nullable: true),+ SortOrder = table.Column<int>(type: "INTEGER", nullable: true)+ },+ constraints: table =>+ {+ table.PrimaryKey("PK_Peoples", x => new { x.ItemId, x.Role, x.ListOrder });+ table.ForeignKey(+ name: "FK_Peoples_BaseItems_ItemId",+ column: x => x.ItemId,+ principalTable: "BaseItems",+ principalColumn: "Id",+ onDelete: ReferentialAction.Cascade);+ });++ migrationBuilder.CreateIndex(+ name: "IX_UserData_BaseItemEntityId",+ table: "UserData",+ column: "BaseItemEntityId");++ migrationBuilder.CreateIndex(+ name: "IX_AncestorIds_Id",+ table: "AncestorIds",+ column: "Id");++ migrationBuilder.CreateIndex(+ name: "IX_AncestorIds_ItemId_AncestorIdText",+ table: "AncestorIds",+ columns: new[] { "ItemId", "AncestorIdText" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItemProviders_ProviderId_ProviderValue_ItemId",+ table: "BaseItemProviders",+ columns: new[] { "ProviderId", "ProviderValue", "ItemId" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Id_Type_IsFolder_IsVirtualItem",+ table: "BaseItems",+ columns: new[] { "Id", "Type", "IsFolder", "IsVirtualItem" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_IsFolder_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated",+ table: "BaseItems",+ columns: new[] { "IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_MediaType_TopParentId_IsVirtualItem_PresentationUniqueKey",+ table: "BaseItems",+ columns: new[] { "MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_ParentId",+ table: "BaseItems",+ column: "ParentId");++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Path",+ table: "BaseItems",+ column: "Path");++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_PresentationUniqueKey",+ table: "BaseItems",+ column: "PresentationUniqueKey");++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_SeasonId",+ table: "BaseItems",+ column: "SeasonId");++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_SeriesId",+ table: "BaseItems",+ column: "SeriesId");++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_TopParentId_Id",+ table: "BaseItems",+ columns: new[] { "TopParentId", "Id" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_IsFolder_IsVirtualItem",+ table: "BaseItems",+ columns: new[] { "Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_SeriesPresentationUniqueKey_PresentationUniqueKey_SortName",+ table: "BaseItems",+ columns: new[] { "Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_TopParentId_Id",+ table: "BaseItems",+ columns: new[] { "Type", "TopParentId", "Id" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_TopParentId_IsVirtualItem_PresentationUniqueKey_DateCreated",+ table: "BaseItems",+ columns: new[] { "Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_TopParentId_PresentationUniqueKey",+ table: "BaseItems",+ columns: new[] { "Type", "TopParentId", "PresentationUniqueKey" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_Type_TopParentId_StartDate",+ table: "BaseItems",+ columns: new[] { "Type", "TopParentId", "StartDate" });++ migrationBuilder.CreateIndex(+ name: "IX_BaseItems_UserDataKey_Type",+ table: "BaseItems",+ columns: new[] { "UserDataKey", "Type" });++ migrationBuilder.CreateIndex(+ name: "IX_ItemValues_ItemId_Type_CleanValue",+ table: "ItemValues",+ columns: new[] { "ItemId", "Type", "CleanValue" });++ migrationBuilder.CreateIndex(+ name: "IX_MediaStreamInfos_StreamIndex",+ table: "MediaStreamInfos",+ column: "StreamIndex");++ migrationBuilder.CreateIndex(+ name: "IX_MediaStreamInfos_StreamIndex_StreamType",+ table: "MediaStreamInfos",+ columns: new[] { "StreamIndex", "StreamType" });++ migrationBuilder.CreateIndex(+ name: "IX_MediaStreamInfos_StreamIndex_StreamType_Language",+ table: "MediaStreamInfos",+ columns: new[] { "StreamIndex", "StreamType", "Language" });++ migrationBuilder.CreateIndex(+ name: "IX_MediaStreamInfos_StreamType",+ table: "MediaStreamInfos",+ column: "StreamType");++ migrationBuilder.CreateIndex(+ name: "IX_Peoples_ItemId_ListOrder",+ table: "Peoples",+ columns: new[] { "ItemId", "ListOrder" });++ migrationBuilder.CreateIndex(+ name: "IX_Peoples_Name",+ table: "Peoples",+ column: "Name");++ migrationBuilder.AddForeignKey(+ name: "FK_UserData_BaseItems_BaseItemEntityId",+ table: "UserData",+ column: "BaseItemEntityId",+ principalTable: "BaseItems",+ principalColumn: "Id");+ }++ /// <inheritdoc />+ protected override void Down(MigrationBuilder migrationBuilder)+ {+ migrationBuilder.DropForeignKey(+ name: "FK_UserData_BaseItems_BaseItemEntityId",+ table: "UserData");++ migrationBuilder.DropTable(+ name: "AncestorIds");++ migrationBuilder.DropTable(+ name: "AttachmentStreamInfos");++ migrationBuilder.DropTable(+ name: "BaseItemProviders");++ migrationBuilder.DropTable(+ name: "Chapters");++ migrationBuilder.DropTable(+ name: "ItemValues");++ migrationBuilder.DropTable(+ name: "MediaStreamInfos");++ migrationBuilder.DropTable(+ name: "Peoples");++ migrationBuilder.DropTable(+ name: "BaseItems");++ migrationBuilder.DropPrimaryKey(+ name: "PK_UserData",+ table: "UserData");++ migrationBuilder.DropIndex(+ name: "IX_UserData_BaseItemEntityId",+ table: "UserData");++ migrationBuilder.DropColumn(+ name: "BaseItemEntityId",+ table: "UserData");++ migrationBuilder.CreateIndex(+ name: "IX_UserData_Key_UserId",+ table: "UserData",+ columns: new[] { "Key", "UserId" },+ unique: true);+ }+ }+}diff --git a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.csindex f6191dd2cd..f74f7d7916 100644--- a/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs+++ b/Jellyfin.Server.Implementations/Migrations/JellyfinDbModelSnapshot.cs@@ -90,6 +90,365 @@ namespace Jellyfin.Server.Implementations.Migrationsb.ToTable("ActivityLogs");});+ modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<Guid>("Id")+ .HasColumnType("TEXT");++ b.Property<string>("AncestorIdText")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Id");++ b.HasIndex("Id");++ b.HasIndex("ItemId", "AncestorIdText");++ b.ToTable("AncestorIds");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Index")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .HasColumnType("TEXT");++ b.Property<string>("Filename")+ .HasColumnType("TEXT");++ b.Property<string>("MimeType")+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Index");++ b.ToTable("AttachmentStreamInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.Property<Guid>("Id")+ .ValueGeneratedOnAdd()+ .HasColumnType("TEXT");++ b.Property<string>("Album")+ .HasColumnType("TEXT");++ b.Property<string>("AlbumArtists")+ .HasColumnType("TEXT");++ b.Property<string>("Artists")+ .HasColumnType("TEXT");++ b.Property<string>("Audio")+ .HasColumnType("TEXT");++ b.Property<string>("ChannelId")+ .HasColumnType("TEXT");++ b.Property<string>("CleanName")+ .HasColumnType("TEXT");++ b.Property<float?>("CommunityRating")+ .HasColumnType("REAL");++ b.Property<float?>("CriticRating")+ .HasColumnType("REAL");++ b.Property<string>("CustomRating")+ .HasColumnType("TEXT");++ b.Property<string>("Data")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateCreated")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastMediaAdded")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastRefreshed")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateLastSaved")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("DateModified")+ .HasColumnType("TEXT");++ b.Property<DateTime>("EndDate")+ .HasColumnType("TEXT");++ b.Property<string>("EpisodeTitle")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalSeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("ExternalServiceId")+ .HasColumnType("TEXT");++ b.Property<string>("ExtraIds")+ .HasColumnType("TEXT");++ b.Property<string>("ExtraType")+ .HasColumnType("TEXT");++ b.Property<string>("ForcedSortName")+ .HasColumnType("TEXT");++ b.Property<string>("Genres")+ .HasColumnType("TEXT");++ b.Property<int?>("Height")+ .HasColumnType("INTEGER");++ b.Property<string>("Images")+ .HasColumnType("TEXT");++ b.Property<int?>("IndexNumber")+ .HasColumnType("INTEGER");++ b.Property<int?>("InheritedParentalRatingValue")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInMixedFolder")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsLocked")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsMovie")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsRepeat")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsSeries")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsVirtualItem")+ .HasColumnType("INTEGER");++ b.Property<float?>("LUFS")+ .HasColumnType("REAL");++ b.Property<string>("LockedFields")+ .HasColumnType("TEXT");++ b.Property<string>("MediaType")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<float?>("NormalizationGain")+ .HasColumnType("REAL");++ b.Property<string>("OfficialRating")+ .HasColumnType("TEXT");++ b.Property<string>("OriginalTitle")+ .HasColumnType("TEXT");++ b.Property<string>("Overview")+ .HasColumnType("TEXT");++ b.Property<string>("OwnerId")+ .HasColumnType("TEXT");++ b.Property<Guid?>("ParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("ParentIndexNumber")+ .HasColumnType("INTEGER");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataCountryCode")+ .HasColumnType("TEXT");++ b.Property<string>("PreferredMetadataLanguage")+ .HasColumnType("TEXT");++ b.Property<DateTime?>("PremiereDate")+ .HasColumnType("TEXT");++ b.Property<string>("PresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("PrimaryVersionId")+ .HasColumnType("TEXT");++ b.Property<string>("ProductionLocations")+ .HasColumnType("TEXT");++ b.Property<int?>("ProductionYear")+ .HasColumnType("INTEGER");++ b.Property<long?>("RunTimeTicks")+ .HasColumnType("INTEGER");++ b.Property<Guid?>("SeasonId")+ .HasColumnType("TEXT");++ b.Property<string>("SeasonName")+ .HasColumnType("TEXT");++ b.Property<Guid?>("SeriesId")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesName")+ .HasColumnType("TEXT");++ b.Property<string>("SeriesPresentationUniqueKey")+ .HasColumnType("TEXT");++ b.Property<string>("ShowId")+ .HasColumnType("TEXT");++ b.Property<long?>("Size")+ .HasColumnType("INTEGER");++ b.Property<string>("SortName")+ .HasColumnType("TEXT");++ b.Property<DateTime>("StartDate")+ .HasColumnType("TEXT");++ b.Property<string>("Studios")+ .HasColumnType("TEXT");++ b.Property<string>("Tagline")+ .HasColumnType("TEXT");++ b.Property<string>("Tags")+ .HasColumnType("TEXT");++ b.Property<Guid?>("TopParentId")+ .HasColumnType("TEXT");++ b.Property<int?>("TotalBitrate")+ .HasColumnType("INTEGER");++ b.Property<string>("TrailerTypes")+ .HasColumnType("TEXT");++ b.Property<string>("Type")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("UnratedType")+ .HasColumnType("TEXT");++ b.Property<string>("UserDataKey")+ .HasColumnType("TEXT");++ b.Property<int?>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("Id");++ b.HasIndex("ParentId");++ b.HasIndex("Path");++ b.HasIndex("PresentationUniqueKey");++ b.HasIndex("SeasonId");++ b.HasIndex("SeriesId");++ b.HasIndex("TopParentId", "Id");++ b.HasIndex("UserDataKey", "Type");++ b.HasIndex("Type", "TopParentId", "Id");++ b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");++ b.HasIndex("Type", "TopParentId", "StartDate");++ b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem");++ b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem");++ b.HasIndex("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName");++ b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");++ b.ToTable("BaseItems");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderId")+ .HasColumnType("TEXT");++ b.Property<string>("ProviderValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "ProviderId");++ b.HasIndex("ProviderId", "ProviderValue", "ItemId");++ b.ToTable("BaseItemProviders");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("ChapterIndex")+ .HasColumnType("INTEGER");++ b.Property<DateTime?>("ImageDateModified")+ .HasColumnType("TEXT");++ b.Property<string>("ImagePath")+ .HasColumnType("TEXT");++ b.Property<string>("Name")+ .HasColumnType("TEXT");++ b.Property<long>("StartPositionTicks")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "ChapterIndex");++ b.ToTable("Chapters");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.CustomItemDisplayPreferences", b =>{b.Property<int>("Id")@@ -270,6 +629,28 @@ namespace Jellyfin.Server.Implementations.Migrationsb.ToTable("ItemDisplayPreferences");});+ modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("Type")+ .HasColumnType("INTEGER");++ b.Property<string>("Value")+ .HasColumnType("TEXT");++ b.Property<string>("CleanValue")+ .IsRequired()+ .HasColumnType("TEXT");++ b.HasKey("ItemId", "Type", "Value");++ b.HasIndex("ItemId", "Type", "CleanValue");++ b.ToTable("ItemValues");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.MediaSegment", b =>{b.Property<Guid>("Id")@@ -297,6 +678,198 @@ namespace Jellyfin.Server.Implementations.Migrationsb.ToTable("MediaSegments");});+ modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<int>("StreamIndex")+ .HasColumnType("INTEGER");++ b.Property<string>("AspectRatio")+ .HasColumnType("TEXT");++ b.Property<float>("AverageFrameRate")+ .HasColumnType("REAL");++ b.Property<int>("BitDepth")+ .HasColumnType("INTEGER");++ b.Property<int>("BitRate")+ .HasColumnType("INTEGER");++ b.Property<int>("BlPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<string>("ChannelLayout")+ .HasColumnType("TEXT");++ b.Property<int>("Channels")+ .HasColumnType("INTEGER");++ b.Property<string>("Codec")+ .HasColumnType("TEXT");++ b.Property<string>("CodecTag")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("CodecTimeBase")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorPrimaries")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorSpace")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("ColorTransfer")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Comment")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("DvBlSignalCompatibilityId")+ .HasColumnType("INTEGER");++ b.Property<int>("DvLevel")+ .HasColumnType("INTEGER");++ b.Property<int>("DvProfile")+ .HasColumnType("INTEGER");++ b.Property<int>("DvVersionMajor")+ .HasColumnType("INTEGER");++ b.Property<int>("DvVersionMinor")+ .HasColumnType("INTEGER");++ b.Property<int>("ElPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int>("Height")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsAnamorphic")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsAvc")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsDefault")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsExternal")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsForced")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsHearingImpaired")+ .HasColumnType("INTEGER");++ b.Property<bool>("IsInterlaced")+ .HasColumnType("INTEGER");++ b.Property<string>("KeyFrames")+ .HasColumnType("TEXT");++ b.Property<string>("Language")+ .HasColumnType("TEXT");++ b.Property<float>("Level")+ .HasColumnType("REAL");++ b.Property<string>("NalLengthSize")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Path")+ .HasColumnType("TEXT");++ b.Property<string>("PixelFormat")+ .HasColumnType("TEXT");++ b.Property<string>("Profile")+ .HasColumnType("TEXT");++ b.Property<float>("RealFrameRate")+ .HasColumnType("REAL");++ b.Property<int>("RefFrames")+ .HasColumnType("INTEGER");++ b.Property<int>("Rotation")+ .HasColumnType("INTEGER");++ b.Property<int>("RpuPresentFlag")+ .HasColumnType("INTEGER");++ b.Property<int>("SampleRate")+ .HasColumnType("INTEGER");++ b.Property<string>("StreamType")+ .HasColumnType("TEXT");++ b.Property<string>("TimeBase")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("Title")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<int>("Width")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "StreamIndex");++ b.HasIndex("StreamIndex");++ b.HasIndex("StreamType");++ b.HasIndex("StreamIndex", "StreamType");++ b.HasIndex("StreamIndex", "StreamType", "Language");++ b.ToTable("MediaStreamInfos");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.People", b =>+ {+ b.Property<Guid>("ItemId")+ .HasColumnType("TEXT");++ b.Property<string>("Role")+ .HasColumnType("TEXT");++ b.Property<int?>("ListOrder")+ .HasColumnType("INTEGER");++ b.Property<string>("Name")+ .IsRequired()+ .HasColumnType("TEXT");++ b.Property<string>("PersonType")+ .HasColumnType("TEXT");++ b.Property<int?>("SortOrder")+ .HasColumnType("INTEGER");++ b.HasKey("ItemId", "Role", "ListOrder");++ b.HasIndex("Name");++ b.HasIndex("ItemId", "ListOrder");++ b.ToTable("Peoples");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>{b.Property<int>("Id")@@ -615,16 +1188,21 @@ namespace Jellyfin.Server.Implementations.MigrationsmodelBuilder.Entity("Jellyfin.Data.Entities.UserData", b =>{+ b.Property<string>("Key")+ .HasColumnType("TEXT");++ b.Property<Guid>("UserId")+ .HasColumnType("TEXT");+b.Property<int?>("AudioStreamIndex").HasColumnType("INTEGER");+ b.Property<Guid?>("BaseItemEntityId")+ .HasColumnType("TEXT");+b.Property<bool>("IsFavorite").HasColumnType("INTEGER");- b.Property<string>("Key")- .IsRequired()- .HasColumnType("TEXT");-b.Property<DateTime?>("LastPlayedDate").HasColumnType("TEXT");@@ -646,13 +1224,11 @@ namespace Jellyfin.Server.Implementations.Migrationsb.Property<int?>("SubtitleStreamIndex").HasColumnType("INTEGER");- b.Property<Guid>("UserId")- .HasColumnType("TEXT");+ b.HasKey("Key", "UserId");- b.HasIndex("UserId");+ b.HasIndex("BaseItemEntityId");- b.HasIndex("Key", "UserId")- .IsUnique();+ b.HasIndex("UserId");b.HasIndex("Key", "UserId", "IsFavorite");@@ -674,6 +1250,77 @@ namespace Jellyfin.Server.Implementations.Migrations.IsRequired();});+ modelBuilder.Entity("Jellyfin.Data.Entities.AncestorId", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("AncestorIds")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.AttachmentStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany()+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Parent")+ .WithMany("DirectChildren")+ .HasForeignKey("ParentId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Season")+ .WithMany("SeasonEpisodes")+ .HasForeignKey("SeasonId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Series")+ .WithMany("SeriesEpisodes")+ .HasForeignKey("SeriesId");++ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "TopParent")+ .WithMany("AllChildren")+ .HasForeignKey("TopParentId");++ b.Navigation("Parent");++ b.Navigation("Season");++ b.Navigation("Series");++ b.Navigation("TopParent");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemProvider", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Provider")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.Chapter", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Chapters")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>{b.HasOne("Jellyfin.Data.Entities.User", null)@@ -709,6 +1356,39 @@ namespace Jellyfin.Server.Implementations.Migrations.IsRequired();});+ modelBuilder.Entity("Jellyfin.Data.Entities.ItemValue", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("ItemValues")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.MediaStreamInfo", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("MediaStreams")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });++ modelBuilder.Entity("Jellyfin.Data.Entities.People", b =>+ {+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", "Item")+ .WithMany("Peoples")+ .HasForeignKey("ItemId")+ .OnDelete(DeleteBehavior.Cascade)+ .IsRequired();++ b.Navigation("Item");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.Permission", b =>{b.HasOne("Jellyfin.Data.Entities.User", null)@@ -738,6 +1418,10 @@ namespace Jellyfin.Server.Implementations.MigrationsmodelBuilder.Entity("Jellyfin.Data.Entities.UserData", b =>{+ b.HasOne("Jellyfin.Data.Entities.BaseItemEntity", null)+ .WithMany("UserData")+ .HasForeignKey("BaseItemEntityId");+b.HasOne("Jellyfin.Data.Entities.User", "User").WithMany().HasForeignKey("UserId")@@ -747,6 +1431,31 @@ namespace Jellyfin.Server.Implementations.Migrationsb.Navigation("User");});+ modelBuilder.Entity("Jellyfin.Data.Entities.BaseItemEntity", b =>+ {+ b.Navigation("AllChildren");++ b.Navigation("AncestorIds");++ b.Navigation("Chapters");++ b.Navigation("DirectChildren");++ b.Navigation("ItemValues");++ b.Navigation("MediaStreams");++ b.Navigation("Peoples");++ b.Navigation("Provider");++ b.Navigation("SeasonEpisodes");++ b.Navigation("SeriesEpisodes");++ b.Navigation("UserData");+ });+modelBuilder.Entity("Jellyfin.Data.Entities.DisplayPreferences", b =>{b.Navigation("HomeSections");diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.csnew file mode 100644index 0000000000..057b6689ac--- /dev/null+++ b/Jellyfin.Server.Implementations/ModelConfiguration/AttachmentStreamInfoConfiguration.cs@@ -0,0 +1,17 @@+using Jellyfin.Data.Entities;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Metadata.Builders;++namespace Jellyfin.Server.Implementations.ModelConfiguration;++/// <summary>+/// FluentAPI configuration for the AttachmentStreamInfo entity.+/// </summary>+public class AttachmentStreamInfoConfiguration : IEntityTypeConfiguration<AttachmentStreamInfo>+{+ /// <inheritdoc/>+ public void Configure(EntityTypeBuilder<AttachmentStreamInfo> builder)+ {+ builder.HasKey(e => new { e.ItemId, e.Index });+ }+}diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.csindex 6f8adb44d9..d74b947840 100644--- a/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs+++ b/Jellyfin.Server.Implementations/ModelConfiguration/BaseItemConfiguration.cs@@ -2,6 +2,7 @@ using System;using Jellyfin.Data.Entities;using Microsoft.EntityFrameworkCore;using Microsoft.EntityFrameworkCore.Metadata.Builders;+using SQLitePCL;namespace Jellyfin.Server.Implementations.ModelConfiguration;@@ -14,10 +15,10 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>public void Configure(EntityTypeBuilder<BaseItemEntity> builder){builder.HasKey(e => e.Id);- builder.HasOne(e => e.Parent);- builder.HasOne(e => e.TopParent);- builder.HasOne(e => e.Season);- builder.HasOne(e => e.Series);+ builder.HasOne(e => e.Parent).WithMany(e => e.DirectChildren).HasForeignKey(e => e.ParentId);+ builder.HasOne(e => e.TopParent).WithMany(e => e.AllChildren).HasForeignKey(e => e.TopParentId);+ builder.HasOne(e => e.Season).WithMany(e => e.SeasonEpisodes).HasForeignKey(e => e.SeasonId);+ builder.HasOne(e => e.Series).WithMany(e => e.SeriesEpisodes).HasForeignKey(e => e.SeriesId);builder.HasMany(e => e.Peoples);builder.HasMany(e => e.UserData);builder.HasMany(e => e.ItemValues);diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.csindex 464fbfb014..5a84f7750a 100644--- a/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs+++ b/Jellyfin.Server.Implementations/ModelConfiguration/ChapterConfiguration.cs@@ -13,7 +13,7 @@ public class ChapterConfiguration : IEntityTypeConfiguration<Chapter>/// <inheritdoc/>public void Configure(EntityTypeBuilder<Chapter> builder){- builder.HasNoKey();- builder.HasIndex(e => new { e.ItemId, e.ChapterIndex });+ builder.HasKey(e => new { e.ItemId, e.ChapterIndex });+ builder.HasOne(e => e.Item);}}diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.csindex a7de6ec327..c39854f5ac 100644--- a/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs+++ b/Jellyfin.Server.Implementations/ModelConfiguration/ItemValuesConfiguration.cs@@ -13,8 +13,7 @@ public class ItemValuesConfiguration : IEntityTypeConfiguration<ItemValue>/// <inheritdoc/>public void Configure(EntityTypeBuilder<ItemValue> builder){- builder.HasNoKey();+ builder.HasKey(e => new { e.ItemId, e.Type, e.Value });builder.HasIndex(e => new { e.ItemId, e.Type, e.CleanValue });- builder.HasIndex(e => new { e.ItemId, e.Type, e.Value });}}diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.csnew file mode 100644index 0000000000..7e572f9a39--- /dev/null+++ b/Jellyfin.Server.Implementations/ModelConfiguration/MediaStreamInfoConfiguration.cs@@ -0,0 +1,22 @@+using System;+using Jellyfin.Data.Entities;+using Microsoft.EntityFrameworkCore;+using Microsoft.EntityFrameworkCore.Metadata.Builders;++namespace Jellyfin.Server.Implementations.ModelConfiguration;++/// <summary>+/// People configuration.+/// </summary>+public class MediaStreamInfoConfiguration : IEntityTypeConfiguration<MediaStreamInfo>+{+ /// <inheritdoc/>+ public void Configure(EntityTypeBuilder<MediaStreamInfo> builder)+ {+ builder.HasKey(e => new { e.ItemId, e.StreamIndex });+ builder.HasIndex(e => e.StreamIndex);+ builder.HasIndex(e => e.StreamType);+ builder.HasIndex(e => new { e.StreamIndex, e.StreamType });+ builder.HasIndex(e => new { e.StreamIndex, e.StreamType, e.Language });+ }+}diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.csindex f6cd39c248..5f5b4dfc74 100644--- a/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs+++ b/Jellyfin.Server.Implementations/ModelConfiguration/PeopleConfiguration.cs@@ -13,7 +13,7 @@ public class PeopleConfiguration : IEntityTypeConfiguration<People>/// <inheritdoc/>public void Configure(EntityTypeBuilder<People> builder){- builder.HasNoKey();+ builder.HasKey(e => new { e.ItemId, e.Role, e.ListOrder });builder.HasIndex(e => new { e.ItemId, e.ListOrder });builder.HasIndex(e => e.Name);}diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.csindex 8e64844378..1113adb7bc 100644--- a/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs+++ b/Jellyfin.Server.Implementations/ModelConfiguration/UserDataConfiguration.cs@@ -13,8 +13,7 @@ public class UserDataConfiguration : IEntityTypeConfiguration<UserData>/// <inheritdoc/>public void Configure(EntityTypeBuilder<UserData> builder){- builder.HasNoKey();- builder.HasIndex(d => new { d.Key, d.UserId }).IsUnique();+ builder.HasKey(d => new { d.Key, d.UserId });builder.HasIndex(d => new { d.Key, d.UserId, d.Played });builder.HasIndex(d => new { d.Key, d.UserId, d.PlaybackPositionTicks });builder.HasIndex(d => new { d.Key, d.UserId, d.IsFavorite });