Added EF BaseItem migration

This commit is contained in:
JPVenson 2024-10-09 11:22:52 +00:00
parent 3dc4024338
commit c2844bda3b
13 changed files with 2780 additions and 24 deletions

View File

@ -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; }

View File

@ -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 BaseItemEntity
public 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 only
public ICollection<People>? Peoples { get; set; }
public ICollection<UserData>? UserData { get; set; }

View File

@ -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> dbPr
Item = entity,
Type = itemValue.MagicNumber,
Value = itemValue.Value,
CleanValue = GetCleanValue(itemValue.Value)
CleanValue = GetCleanValue(itemValue.Value),
ItemId = entity.Id
});
}
}

File diff suppressed because it is too large Load Diff

View File

@ -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);
}
}
}

View File

@ -90,6 +90,365 @@ namespace Jellyfin.Server.Implementations.Migrations
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")
@ -270,6 +629,28 @@ namespace Jellyfin.Server.Implementations.Migrations
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")
@ -297,6 +678,198 @@ namespace Jellyfin.Server.Implementations.Migrations
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")
@ -615,16 +1188,21 @@ namespace Jellyfin.Server.Implementations.Migrations
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<string>("Key")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime?>("LastPlayedDate")
.HasColumnType("TEXT");
@ -646,14 +1224,12 @@ namespace Jellyfin.Server.Implementations.Migrations
b.Property<int?>("SubtitleStreamIndex")
.HasColumnType("INTEGER");
b.Property<Guid>("UserId")
.HasColumnType("TEXT");
b.HasKey("Key", "UserId");
b.HasIndex("BaseItemEntityId");
b.HasIndex("UserId");
b.HasIndex("Key", "UserId")
.IsUnique();
b.HasIndex("Key", "UserId", "IsFavorite");
b.HasIndex("Key", "UserId", "LastPlayedDate");
@ -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.Migrations
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")
@ -747,6 +1431,31 @@ namespace Jellyfin.Server.Implementations.Migrations
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");

View File

@ -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 });
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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 });
}
}

View File

@ -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 });
}
}

View File

@ -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);
}

View File

@ -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 });