diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-10-26 17:43:36 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2021-10-26 17:43:36 -0600 |
| commit | f78f1e834ce1907157d4d43cf8564cf40d05fb9f (patch) | |
| tree | beb4e348e4d338a8b459f8a421ba19409d478ba9 /Jellyfin.Server.Implementations/ModelConfiguration/DisplayPreferencesConfiguration.cs | |
| parent | 2888567ea53c1c839b0cd69e0ec1168cf51f36a8 (diff) | |
| parent | 39d5bdac96b17eb92bd304736cc2728832e1cad0 (diff) | |
Merge remote-tracking branch 'upstream/master' into client-logger
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(); + } + } +} |
