diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-10-08 07:49:40 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2021-10-08 07:49:40 -0600 |
| commit | 3bbd98cc3fb4e69b5d5471ab7cbdcc22d59a8eb9 (patch) | |
| tree | d6a0aeb4896ec9ab4305916f0380606483180786 /Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs | |
| parent | 7a7fe3e681eca87cde631336c9af565fd6dfe0d7 (diff) | |
| parent | a01f9775fffaacfd0fc03b24bff366b4701fe45e (diff) | |
Merge remote-tracking branch 'upstream/master' into schedules-direct
Diffstat (limited to 'Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs')
| -rw-r--r-- | Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs b/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs new file mode 100644 index 000000000..9b437861b --- /dev/null +++ b/Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs @@ -0,0 +1,25 @@ +using Jellyfin.Data.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace Jellyfin.Server.Implementations.ModelConfiguration +{ + /// <summary> + /// FluentAPI configuration for the DisplayPreferencesConfiguration entity. + /// </summary> + public class DisplayPreferencesConfiguration : IEntityTypeConfiguration<DisplayPreferences> + { + /// <inheritdoc/> + public void Configure(EntityTypeBuilder<DisplayPreferences> builder) + { + builder + .HasMany(d => d.HomeSections) + .WithOne() + .OnDelete(DeleteBehavior.Cascade); + + builder + .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client }) + .IsUnique(); + } + } +} |
