< Summary - Jellyfin

Information
Class: Jellyfin.Database.Implementations.ModelConfiguration.BaseItemConfiguration
Assembly: Jellyfin.Database.Implementations
File(s): /srv/git/jellyfin/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs
Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 57
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Configure(...)100%11100%

File(s)

/srv/git/jellyfin/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemConfiguration.cs

#LineLine coverage
 1using Jellyfin.Database.Implementations.Entities;
 2using Microsoft.EntityFrameworkCore;
 3using Microsoft.EntityFrameworkCore.Metadata.Builders;
 4
 5namespace Jellyfin.Database.Implementations.ModelConfiguration;
 6
 7/// <summary>
 8/// Configuration for BaseItem.
 9/// </summary>
 10public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
 11{
 12    /// <inheritdoc/>
 13    public void Configure(EntityTypeBuilder<BaseItemEntity> builder)
 14    {
 215        builder.HasKey(e => e.Id);
 16        // TODO: See rant in entity file.
 17        // builder.HasOne(e => e.Parent).WithMany(e => e.DirectChildren).HasForeignKey(e => e.ParentId);
 18        // builder.HasOne(e => e.TopParent).WithMany(e => e.AllChildren).HasForeignKey(e => e.TopParentId);
 19        // builder.HasOne(e => e.Season).WithMany(e => e.SeasonEpisodes).HasForeignKey(e => e.SeasonId);
 20        // builder.HasOne(e => e.Series).WithMany(e => e.SeriesEpisodes).HasForeignKey(e => e.SeriesId);
 221        builder.HasMany(e => e.Peoples);
 222        builder.HasMany(e => e.UserData);
 223        builder.HasMany(e => e.ItemValues);
 224        builder.HasMany(e => e.MediaStreams);
 225        builder.HasMany(e => e.Chapters);
 226        builder.HasMany(e => e.Provider);
 227        builder.HasMany(e => e.ParentAncestors);
 228        builder.HasMany(e => e.Children);
 229        builder.HasMany(e => e.LockedFields);
 230        builder.HasMany(e => e.TrailerTypes);
 231        builder.HasMany(e => e.Images);
 32
 233        builder.HasIndex(e => e.Path);
 234        builder.HasIndex(e => e.ParentId);
 235        builder.HasIndex(e => e.PresentationUniqueKey);
 236        builder.HasIndex(e => new { e.Id, e.Type, e.IsFolder, e.IsVirtualItem });
 37
 38        // covering index
 239        builder.HasIndex(e => new { e.TopParentId, e.Id });
 40        // series
 241        builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.PresentationUniqueKey, e.SortName });
 42        // series counts
 43        // seriesdateplayed sort order
 244        builder.HasIndex(e => new { e.Type, e.SeriesPresentationUniqueKey, e.IsFolder, e.IsVirtualItem });
 45        // live tv programs
 246        builder.HasIndex(e => new { e.Type, e.TopParentId, e.StartDate });
 47        // covering index for getitemvalues
 248        builder.HasIndex(e => new { e.Type, e.TopParentId, e.Id });
 49        // used by movie suggestions
 250        builder.HasIndex(e => new { e.Type, e.TopParentId, e.PresentationUniqueKey });
 51        // latest items
 252        builder.HasIndex(e => new { e.Type, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated });
 253        builder.HasIndex(e => new { e.IsFolder, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey, e.DateCreated }
 54        // resume
 255        builder.HasIndex(e => new { e.MediaType, e.TopParentId, e.IsVirtualItem, e.PresentationUniqueKey });
 256    }
 57}