diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-01-17 15:02:26 +0100 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-01-18 19:46:37 +0100 |
| commit | cc2ccd1bf344ec38059164d1aa9b261e50807eac (patch) | |
| tree | 5384fe332d2a24089e2a268b81899affb14a49f9 /src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration | |
| parent | 1491494bcb8764e48133123226a8e025c5357474 (diff) | |
Add LinkedChildren database table for normalized relationships
Introduces a new database table to store linked child relationships for
boxsets, playlists, and video alternate versions. This replaces the
JSON-serialized Data column approach with a proper relational structure.
- Add LinkedChildEntity and LinkedChildType enum
- Add entity configuration with proper foreign keys
- Add EF Core migration for SQLite
Diffstat (limited to 'src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration')
| -rw-r--r-- | src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/LinkedChildConfiguration.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/LinkedChildConfiguration.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/LinkedChildConfiguration.cs new file mode 100644 index 0000000000..44bd01ad63 --- /dev/null +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/LinkedChildConfiguration.cs @@ -0,0 +1,33 @@ +using Jellyfin.Database.Implementations.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace Jellyfin.Database.Implementations.ModelConfiguration; + +/// <summary> +/// LinkedChildEntity configuration. +/// </summary> +public class LinkedChildConfiguration : IEntityTypeConfiguration<LinkedChildEntity> +{ + /// <inheritdoc/> + public void Configure(EntityTypeBuilder<LinkedChildEntity> builder) + { + builder.ToTable("LinkedChildren"); + builder.HasKey(e => new { e.ParentId, e.ChildId }); + builder.HasIndex(e => e.ParentId); + builder.HasIndex(e => e.ChildId); + builder.HasIndex(e => new { e.ParentId, e.SortOrder }); + builder.HasIndex(e => new { e.ParentId, e.ChildType }); + builder.HasIndex(e => new { e.ChildId, e.ChildType }); + + builder.HasOne(e => e.Parent) + .WithMany(e => e.LinkedChildEntities) + .HasForeignKey(e => e.ParentId) + .OnDelete(DeleteBehavior.NoAction); + + builder.HasOne(e => e.Child) + .WithMany(e => e.LinkedChildOfEntities) + .HasForeignKey(e => e.ChildId) + .OnDelete(DeleteBehavior.NoAction); + } +} |
