// <auto-generated />
using System;
using Jellyfin.Database.Implementations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Jellyfin.Database.Providers.Postgres.Migrations
{
    [DbContext(typeof(JellyfinDbContext))]
    [Migration("20260709164134_AddUserDataRowVersion")]
    partial class AddUserDataRowVersion
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "11.0.0-preview.1.26104.118")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<int>("DayOfWeek")
                        .HasColumnType("integer")
                        .HasColumnName("day_of_week");

                    b.Property<double>("EndHour")
                        .HasColumnType("double precision")
                        .HasColumnName("end_hour");

                    b.Property<double>("StartHour")
                        .HasColumnType("double precision")
                        .HasColumnName("start_hour");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("access_schedules", "users");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ActivityLog", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("DateCreated")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<string>("ItemId")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)")
                        .HasColumnName("item_id");

                    b.Property<int>("LogSeverity")
                        .HasColumnType("integer")
                        .HasColumnName("log_severity");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)")
                        .HasColumnName("name");

                    b.Property<string>("Overview")
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)")
                        .HasColumnName("overview");

                    b.Property<long>("RowVersion")
                        .IsConcurrencyToken()
                        .HasColumnType("bigint")
                        .HasColumnName("row_version");

                    b.Property<string>("ShortOverview")
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)")
                        .HasColumnName("short_overview");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)")
                        .HasColumnName("type");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("DateCreated");

                    b.ToTable("activity_logs", "activitylog");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<Guid>("ParentItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("parent_item_id");

                    b.HasKey("ItemId", "ParentItemId");

                    b.HasIndex("ParentItemId");

                    b.ToTable("ancestor_ids", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("Index")
                        .HasColumnType("integer")
                        .HasColumnName("index");

                    b.Property<string>("Codec")
                        .HasColumnType("text")
                        .HasColumnName("codec");

                    b.Property<string>("CodecTag")
                        .HasColumnType("text")
                        .HasColumnName("codec_tag");

                    b.Property<string>("Comment")
                        .HasColumnType("text")
                        .HasColumnName("comment");

                    b.Property<string>("Filename")
                        .HasColumnType("text")
                        .HasColumnName("filename");

                    b.Property<string>("MimeType")
                        .HasColumnType("text")
                        .HasColumnName("mime_type");

                    b.HasKey("ItemId", "Index");

                    b.ToTable("attachment_stream_infos", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AudioStreamDetails", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("StreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("stream_index");

                    b.Property<string>("ChannelLayout")
                        .HasColumnType("text")
                        .HasColumnName("channel_layout");

                    b.Property<int?>("Channels")
                        .HasColumnType("integer")
                        .HasColumnName("channels");

                    b.Property<bool?>("IsHearingImpaired")
                        .HasColumnType("boolean")
                        .HasColumnName("is_hearing_impaired");

                    b.Property<int?>("SampleRate")
                        .HasColumnType("integer")
                        .HasColumnName("sample_rate");

                    b.HasKey("ItemId", "StreamIndex");

                    b.ToTable("audio_stream_details", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemAudioExtras", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("Album")
                        .HasColumnType("text")
                        .HasColumnName("album");

                    b.Property<string>("AlbumArtists")
                        .HasColumnType("text")
                        .HasColumnName("album_artists");

                    b.Property<string>("Artists")
                        .HasColumnType("text")
                        .HasColumnName("artists");

                    b.Property<float?>("LUFS")
                        .HasColumnType("real")
                        .HasColumnName("lufs");

                    b.Property<float?>("NormalizationGain")
                        .HasColumnType("real")
                        .HasColumnName("normalization_gain");

                    b.HasKey("ItemId");

                    b.ToTable("base_item_audio_extras", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Guid?>("ChannelId")
                        .HasColumnType("uuid")
                        .HasColumnName("channel_id");

                    b.Property<string>("CleanName")
                        .HasColumnType("text")
                        .HasColumnName("clean_name");

                    b.Property<float?>("CommunityRating")
                        .HasColumnType("real")
                        .HasColumnName("community_rating");

                    b.Property<float?>("CriticRating")
                        .HasColumnType("real")
                        .HasColumnName("critic_rating");

                    b.Property<string>("CustomRating")
                        .HasColumnType("text")
                        .HasColumnName("custom_rating");

                    b.Property<string>("Data")
                        .HasColumnType("text")
                        .HasColumnName("data");

                    b.Property<DateTime?>("DateCreated")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<DateTime?>("DateLastMediaAdded")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_last_media_added");

                    b.Property<DateTime?>("DateLastRefreshed")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_last_refreshed");

                    b.Property<DateTime?>("DateLastSaved")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_last_saved");

                    b.Property<DateTime?>("DateModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_modified");

                    b.Property<string>("ExternalId")
                        .HasColumnType("text")
                        .HasColumnName("external_id");

                    b.Property<string>("ExtraIds")
                        .HasColumnType("text")
                        .HasColumnName("extra_ids");

                    b.Property<int?>("ExtraType")
                        .HasColumnType("integer")
                        .HasColumnName("extra_type");

                    b.Property<string>("ForcedSortName")
                        .HasColumnType("text")
                        .HasColumnName("forced_sort_name");

                    b.Property<string>("Genres")
                        .HasColumnType("text")
                        .HasColumnName("genres");

                    b.Property<int?>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<int?>("IndexNumber")
                        .HasColumnType("integer")
                        .HasColumnName("index_number");

                    b.Property<int?>("InheritedParentalRatingSubValue")
                        .HasColumnType("integer")
                        .HasColumnName("inherited_parental_rating_sub_value");

                    b.Property<int?>("InheritedParentalRatingValue")
                        .HasColumnType("integer")
                        .HasColumnName("inherited_parental_rating_value");

                    b.Property<bool>("IsFolder")
                        .HasColumnType("boolean")
                        .HasColumnName("is_folder");

                    b.Property<bool>("IsInMixedFolder")
                        .HasColumnType("boolean")
                        .HasColumnName("is_in_mixed_folder");

                    b.Property<bool>("IsLocked")
                        .HasColumnType("boolean")
                        .HasColumnName("is_locked");

                    b.Property<bool>("IsMovie")
                        .HasColumnType("boolean")
                        .HasColumnName("is_movie");

                    b.Property<bool>("IsRepeat")
                        .HasColumnType("boolean")
                        .HasColumnName("is_repeat");

                    b.Property<bool>("IsSeries")
                        .HasColumnType("boolean")
                        .HasColumnName("is_series");

                    b.Property<bool>("IsVirtualItem")
                        .HasColumnType("boolean")
                        .HasColumnName("is_virtual_item");

                    b.Property<string>("MediaType")
                        .HasColumnType("text")
                        .HasColumnName("media_type");

                    b.Property<string>("Name")
                        .HasColumnType("text")
                        .HasColumnName("name");

                    b.Property<string>("OfficialRating")
                        .HasColumnType("text")
                        .HasColumnName("official_rating");

                    b.Property<string>("OriginalTitle")
                        .HasColumnType("text")
                        .HasColumnName("original_title");

                    b.Property<string>("Overview")
                        .HasColumnType("text")
                        .HasColumnName("overview");

                    b.Property<string>("OwnerId")
                        .HasColumnType("text")
                        .HasColumnName("owner_id");

                    b.Property<Guid?>("ParentId")
                        .HasColumnType("uuid")
                        .HasColumnName("parent_id");

                    b.Property<int?>("ParentIndexNumber")
                        .HasColumnType("integer")
                        .HasColumnName("parent_index_number");

                    b.Property<string>("Path")
                        .HasColumnType("text")
                        .HasColumnName("path");

                    b.Property<string>("PreferredMetadataCountryCode")
                        .HasColumnType("text")
                        .HasColumnName("preferred_metadata_country_code");

                    b.Property<string>("PreferredMetadataLanguage")
                        .HasColumnType("text")
                        .HasColumnName("preferred_metadata_language");

                    b.Property<DateTime?>("PremiereDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("premiere_date");

                    b.Property<string>("PresentationUniqueKey")
                        .HasColumnType("text")
                        .HasColumnName("presentation_unique_key");

                    b.Property<string>("PrimaryVersionId")
                        .HasColumnType("text")
                        .HasColumnName("primary_version_id");

                    b.Property<string>("ProductionLocations")
                        .HasColumnType("text")
                        .HasColumnName("production_locations");

                    b.Property<int?>("ProductionYear")
                        .HasColumnType("integer")
                        .HasColumnName("production_year");

                    b.Property<long?>("RunTimeTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("run_time_ticks");

                    b.Property<long?>("Size")
                        .HasColumnType("bigint")
                        .HasColumnName("size");

                    b.Property<string>("SortName")
                        .HasColumnType("text")
                        .HasColumnName("sort_name");

                    b.Property<string>("Studios")
                        .HasColumnType("text")
                        .HasColumnName("studios");

                    b.Property<string>("Tagline")
                        .HasColumnType("text")
                        .HasColumnName("tagline");

                    b.Property<string>("Tags")
                        .HasColumnType("text")
                        .HasColumnName("tags");

                    b.Property<Guid?>("TopParentId")
                        .HasColumnType("uuid")
                        .HasColumnName("top_parent_id");

                    b.Property<int?>("TotalBitrate")
                        .HasColumnType("integer")
                        .HasColumnName("total_bitrate");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("type");

                    b.Property<string>("UnratedType")
                        .HasColumnType("text")
                        .HasColumnName("unrated_type");

                    b.Property<int?>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.HasKey("Id");

                    b.HasIndex("ParentId");

                    b.HasIndex("Path");

                    b.HasIndex("PresentationUniqueKey");

                    b.HasIndex("TopParentId", "Id");

                    b.HasIndex("Type", "TopParentId", "Id");

                    b.HasIndex("Type", "TopParentId", "PresentationUniqueKey");

                    b.HasIndex("Id", "Type", "IsFolder", "IsVirtualItem");

                    b.HasIndex("MediaType", "TopParentId", "IsVirtualItem", "PresentationUniqueKey");

                    b.HasIndex("IsFolder", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");

                    b.HasIndex("Type", "TopParentId", "IsVirtualItem", "PresentationUniqueKey", "DateCreated");

                    b.ToTable("base_items", "library");

                    b.HasData(
                        new
                        {
                            Id = new Guid("00000000-0000-0000-0000-000000000001"),
                            IsFolder = false,
                            IsInMixedFolder = false,
                            IsLocked = false,
                            IsMovie = false,
                            IsRepeat = false,
                            IsSeries = false,
                            IsVirtualItem = false,
                            Name = "This is a placeholder item for UserData that has been detacted from its original item",
                            Type = "PLACEHOLDER"
                        });
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<byte[]>("Blurhash")
                        .HasColumnType("bytea")
                        .HasColumnName("blurhash");

                    b.Property<DateTime?>("DateModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_modified");

                    b.Property<int>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<int>("ImageType")
                        .HasColumnType("integer")
                        .HasColumnName("image_type");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("Path")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("path");

                    b.Property<int>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.HasKey("Id");

                    b.HasIndex("ItemId");

                    b.ToTable("base_item_image_infos", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemLiveTvExtras", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int?>("Audio")
                        .HasColumnType("integer")
                        .HasColumnName("audio");

                    b.Property<DateTime?>("EndDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("end_date");

                    b.Property<string>("EpisodeTitle")
                        .HasColumnType("text")
                        .HasColumnName("episode_title");

                    b.Property<string>("ExternalSeriesId")
                        .HasColumnType("text")
                        .HasColumnName("external_series_id");

                    b.Property<string>("ExternalServiceId")
                        .HasColumnType("text")
                        .HasColumnName("external_service_id");

                    b.Property<string>("ShowId")
                        .HasColumnType("text")
                        .HasColumnName("show_id");

                    b.Property<DateTime?>("StartDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("start_date");

                    b.HasKey("ItemId");

                    b.HasIndex("EndDate");

                    b.HasIndex("StartDate");

                    b.ToTable("base_item_live_tv_extras", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.HasKey("Id", "ItemId");

                    b.HasIndex("ItemId");

                    b.ToTable("base_item_metadata_fields", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("ProviderId")
                        .HasColumnType("text")
                        .HasColumnName("provider_id");

                    b.Property<string>("ProviderValue")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("provider_value");

                    b.HasKey("ItemId", "ProviderId");

                    b.HasIndex("ProviderId", "ProviderValue", "ItemId");

                    b.ToTable("base_item_providers", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.HasKey("Id", "ItemId");

                    b.HasIndex("ItemId");

                    b.ToTable("base_item_trailer_types", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTvExtras", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<Guid?>("SeasonId")
                        .HasColumnType("uuid")
                        .HasColumnName("season_id");

                    b.Property<string>("SeasonName")
                        .HasColumnType("text")
                        .HasColumnName("season_name");

                    b.Property<Guid?>("SeriesId")
                        .HasColumnType("uuid")
                        .HasColumnName("series_id");

                    b.Property<string>("SeriesName")
                        .HasColumnType("text")
                        .HasColumnName("series_name");

                    b.Property<string>("SeriesPresentationUniqueKey")
                        .HasColumnType("text")
                        .HasColumnName("series_presentation_unique_key");

                    b.HasKey("ItemId");

                    b.HasIndex("SeriesId");

                    b.HasIndex("SeriesPresentationUniqueKey");

                    b.ToTable("base_item_tv_extras", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("ChapterIndex")
                        .HasColumnType("integer")
                        .HasColumnName("chapter_index");

                    b.Property<DateTime?>("ImageDateModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("image_date_modified");

                    b.Property<string>("ImagePath")
                        .HasColumnType("text")
                        .HasColumnName("image_path");

                    b.Property<string>("Name")
                        .HasColumnType("text")
                        .HasColumnName("name");

                    b.Property<long>("StartPositionTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("start_position_ticks");

                    b.HasKey("ItemId", "ChapterIndex");

                    b.ToTable("chapters", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.CustomItemDisplayPreferences", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("Client")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("client");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("Key")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("key");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<string>("Value")
                        .HasColumnType("text")
                        .HasColumnName("value");

                    b.HasKey("Id");

                    b.HasIndex("UserId", "ItemId", "Client", "Key")
                        .IsUnique();

                    b.ToTable("custom_item_display_preferences", "displaypreferences");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<int>("ChromecastVersion")
                        .HasColumnType("integer")
                        .HasColumnName("chromecast_version");

                    b.Property<string>("Client")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("client");

                    b.Property<string>("DashboardTheme")
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("dashboard_theme");

                    b.Property<bool>("EnableNextVideoInfoOverlay")
                        .HasColumnType("boolean")
                        .HasColumnName("enable_next_video_info_overlay");

                    b.Property<int?>("IndexBy")
                        .HasColumnType("integer")
                        .HasColumnName("index_by");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("ScrollDirection")
                        .HasColumnType("integer")
                        .HasColumnName("scroll_direction");

                    b.Property<bool>("ShowBackdrop")
                        .HasColumnType("boolean")
                        .HasColumnName("show_backdrop");

                    b.Property<bool>("ShowSidebar")
                        .HasColumnType("boolean")
                        .HasColumnName("show_sidebar");

                    b.Property<int>("SkipBackwardLength")
                        .HasColumnType("integer")
                        .HasColumnName("skip_backward_length");

                    b.Property<int>("SkipForwardLength")
                        .HasColumnType("integer")
                        .HasColumnName("skip_forward_length");

                    b.Property<string>("TvHome")
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("tv_home");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("UserId", "ItemId", "Client")
                        .IsUnique();

                    b.ToTable("display_preferences", "displaypreferences");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<int>("DisplayPreferencesId")
                        .HasColumnType("integer")
                        .HasColumnName("display_preferences_id");

                    b.Property<int>("Order")
                        .HasColumnType("integer")
                        .HasColumnName("order");

                    b.Property<int>("Type")
                        .HasColumnType("integer")
                        .HasColumnName("type");

                    b.HasKey("Id");

                    b.HasIndex("DisplayPreferencesId");

                    b.ToTable("home_sections", "displaypreferences");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<DateTime>("LastModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_modified");

                    b.Property<string>("Path")
                        .IsRequired()
                        .HasMaxLength(512)
                        .HasColumnType("character varying(512)")
                        .HasColumnName("path");

                    b.Property<Guid?>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("UserId")
                        .IsUnique();

                    b.ToTable("image_infos", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("Client")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("client");

                    b.Property<int?>("IndexBy")
                        .HasColumnType("integer")
                        .HasColumnName("index_by");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<bool>("RememberIndexing")
                        .HasColumnType("boolean")
                        .HasColumnName("remember_indexing");

                    b.Property<bool>("RememberSorting")
                        .HasColumnType("boolean")
                        .HasColumnName("remember_sorting");

                    b.Property<string>("SortBy")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)")
                        .HasColumnName("sort_by");

                    b.Property<int>("SortOrder")
                        .HasColumnType("integer")
                        .HasColumnName("sort_order");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<int>("ViewType")
                        .HasColumnType("integer")
                        .HasColumnName("view_type");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("item_display_preferences", "displaypreferences");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>
                {
                    b.Property<Guid>("ItemValueId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("item_value_id");

                    b.Property<string>("CleanValue")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("clean_value");

                    b.Property<int>("Type")
                        .HasColumnType("integer")
                        .HasColumnName("type");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("value");

                    b.HasKey("ItemValueId");

                    b.HasIndex("Type", "CleanValue");

                    b.HasIndex("Type", "Value")
                        .IsUnique();

                    b.ToTable("item_values", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>
                {
                    b.Property<Guid>("ItemValueId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_value_id");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.HasKey("ItemValueId", "ItemId");

                    b.HasIndex("ItemId");

                    b.ToTable("item_values_map", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.PrimitiveCollection<long[]>("KeyframeTicks")
                        .HasColumnType("bigint[]")
                        .HasColumnName("keyframe_ticks");

                    b.Property<long>("TotalDuration")
                        .HasColumnType("bigint")
                        .HasColumnName("total_duration");

                    b.HasKey("ItemId");

                    b.ToTable("keyframe_data", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.LibraryOptionsEntity", b =>
                {
                    b.Property<string>("LibraryPath")
                        .HasColumnType("text")
                        .HasColumnName("library_path");

                    b.Property<DateTime>("DateCreated")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<DateTime>("DateModified")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_modified");

                    b.Property<string>("OptionsJson")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasColumnName("options_json");

                    b.Property<int>("Version")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasDefaultValue(1)
                        .HasColumnName("version");

                    b.HasKey("LibraryPath");

                    b.HasIndex("DateModified")
                        .IsDescending();

                    b.ToTable("library_options", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaSegment", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<long>("EndTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("end_ticks");

                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("SegmentProviderId")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("segment_provider_id");

                    b.Property<long>("StartTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("start_ticks");

                    b.Property<int>("Type")
                        .HasColumnType("integer")
                        .HasColumnName("type");

                    b.HasKey("Id");

                    b.ToTable("media_segments", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("StreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("stream_index");

                    b.Property<int?>("BitRate")
                        .HasColumnType("integer")
                        .HasColumnName("bit_rate");

                    b.Property<string>("Codec")
                        .HasColumnType("text")
                        .HasColumnName("codec");

                    b.Property<string>("CodecTag")
                        .HasColumnType("text")
                        .HasColumnName("codec_tag");

                    b.Property<string>("CodecTimeBase")
                        .HasColumnType("text")
                        .HasColumnName("codec_time_base");

                    b.Property<string>("Comment")
                        .HasColumnType("text")
                        .HasColumnName("comment");

                    b.Property<bool?>("IsAvc")
                        .HasColumnType("boolean")
                        .HasColumnName("is_avc");

                    b.Property<bool>("IsDefault")
                        .HasColumnType("boolean")
                        .HasColumnName("is_default");

                    b.Property<bool>("IsExternal")
                        .HasColumnType("boolean")
                        .HasColumnName("is_external");

                    b.Property<bool>("IsForced")
                        .HasColumnType("boolean")
                        .HasColumnName("is_forced");

                    b.Property<string>("Language")
                        .HasColumnType("text")
                        .HasColumnName("language");

                    b.Property<float?>("Level")
                        .HasColumnType("real")
                        .HasColumnName("level");

                    b.Property<string>("Path")
                        .HasColumnType("text")
                        .HasColumnName("path");

                    b.Property<string>("Profile")
                        .HasColumnType("text")
                        .HasColumnName("profile");

                    b.Property<int>("StreamType")
                        .HasColumnType("integer")
                        .HasColumnName("stream_type");

                    b.Property<string>("TimeBase")
                        .HasColumnType("text")
                        .HasColumnName("time_base");

                    b.Property<string>("Title")
                        .HasColumnType("text")
                        .HasColumnName("title");

                    b.HasKey("ItemId", "StreamIndex");

                    b.HasIndex("StreamIndex");

                    b.HasIndex("StreamType");

                    b.HasIndex("StreamIndex", "StreamType");

                    b.HasIndex("StreamIndex", "StreamType", "Language");

                    b.ToTable("media_stream_infos", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("name");

                    b.Property<string>("PersonType")
                        .HasColumnType("text")
                        .HasColumnName("person_type");

                    b.HasKey("Id");

                    b.HasIndex("Name");

                    b.ToTable("peoples", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<Guid>("PeopleId")
                        .HasColumnType("uuid")
                        .HasColumnName("people_id");

                    b.Property<string>("Role")
                        .HasColumnType("text")
                        .HasColumnName("role");

                    b.Property<int?>("ListOrder")
                        .HasColumnType("integer")
                        .HasColumnName("list_order");

                    b.Property<int?>("SortOrder")
                        .HasColumnType("integer")
                        .HasColumnName("sort_order");

                    b.HasKey("ItemId", "PeopleId", "Role");

                    b.HasIndex("PeopleId");

                    b.HasIndex("ItemId", "ListOrder");

                    b.HasIndex("ItemId", "SortOrder");

                    b.ToTable("people_base_item_map", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<int>("Kind")
                        .HasColumnType("integer")
                        .HasColumnName("kind");

                    b.Property<Guid?>("Permission_Permissions_Guid")
                        .HasColumnType("uuid")
                        .HasColumnName("permission_permissions_guid");

                    b.Property<long>("RowVersion")
                        .IsConcurrencyToken()
                        .HasColumnType("bigint")
                        .HasColumnName("row_version");

                    b.Property<Guid?>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<bool>("Value")
                        .HasColumnType("boolean")
                        .HasColumnName("value");

                    b.HasKey("Id");

                    b.HasIndex("UserId", "Kind")
                        .IsUnique()
                        .HasFilter("[UserId] IS NOT NULL");

                    b.ToTable("permissions", "users");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<int>("Kind")
                        .HasColumnType("integer")
                        .HasColumnName("kind");

                    b.Property<Guid?>("Preference_Preferences_Guid")
                        .HasColumnType("uuid")
                        .HasColumnName("preference_preferences_guid");

                    b.Property<long>("RowVersion")
                        .IsConcurrencyToken()
                        .HasColumnType("bigint")
                        .HasColumnName("row_version");

                    b.Property<Guid?>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasMaxLength(65535)
                        .HasColumnType("character varying(65535)")
                        .HasColumnName("value");

                    b.HasKey("Id");

                    b.HasIndex("UserId", "Kind")
                        .IsUnique()
                        .HasFilter("[UserId] IS NOT NULL");

                    b.ToTable("preferences", "users");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.ApiKey", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("AccessToken")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("access_token");

                    b.Property<DateTime>("DateCreated")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<DateTime>("DateLastActivity")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_last_activity");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)")
                        .HasColumnName("name");

                    b.HasKey("Id");

                    b.HasIndex("AccessToken")
                        .IsUnique();

                    b.ToTable("api_keys", "authentication");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("AccessToken")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("access_token");

                    b.Property<string>("AppName")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)")
                        .HasColumnName("app_name");

                    b.Property<string>("AppVersion")
                        .IsRequired()
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("app_version");

                    b.Property<DateTime>("DateCreated")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<DateTime>("DateLastActivity")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_last_activity");

                    b.Property<DateTime>("DateModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_modified");

                    b.Property<string>("DeviceId")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)")
                        .HasColumnName("device_id");

                    b.Property<string>("DeviceName")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)")
                        .HasColumnName("device_name");

                    b.Property<bool>("IsActive")
                        .HasColumnType("boolean")
                        .HasColumnName("is_active");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("DeviceId");

                    b.HasIndex("AccessToken", "DateLastActivity");

                    b.HasIndex("DeviceId", "DateLastActivity");

                    b.HasIndex("UserId", "DeviceId");

                    b.ToTable("devices", "authentication");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.DeviceOptions", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));

                    b.Property<string>("CustomName")
                        .HasColumnType("text")
                        .HasColumnName("custom_name");

                    b.Property<string>("DeviceId")
                        .IsRequired()
                        .HasColumnType("text")
                        .HasColumnName("device_id");

                    b.HasKey("Id");

                    b.HasIndex("DeviceId")
                        .IsUnique();

                    b.ToTable("device_options", "authentication");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.TrickplayInfo", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.Property<int>("Bandwidth")
                        .HasColumnType("integer")
                        .HasColumnName("bandwidth");

                    b.Property<int>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<int>("Interval")
                        .HasColumnType("integer")
                        .HasColumnName("interval");

                    b.Property<int>("ThumbnailCount")
                        .HasColumnType("integer")
                        .HasColumnName("thumbnail_count");

                    b.Property<int>("TileHeight")
                        .HasColumnType("integer")
                        .HasColumnName("tile_height");

                    b.Property<int>("TileWidth")
                        .HasColumnType("integer")
                        .HasColumnName("tile_width");

                    b.HasKey("ItemId", "Width");

                    b.ToTable("trickplay_infos", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<string>("AudioLanguagePreference")
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("audio_language_preference");

                    b.Property<string>("AuthenticationProviderId")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("authentication_provider_id");

                    b.Property<string>("CastReceiverId")
                        .HasMaxLength(32)
                        .HasColumnType("character varying(32)")
                        .HasColumnName("cast_receiver_id");

                    b.Property<bool>("DisplayCollectionsView")
                        .HasColumnType("boolean")
                        .HasColumnName("display_collections_view");

                    b.Property<bool>("DisplayMissingEpisodes")
                        .HasColumnType("boolean")
                        .HasColumnName("display_missing_episodes");

                    b.Property<bool>("EnableAutoLogin")
                        .HasColumnType("boolean")
                        .HasColumnName("enable_auto_login");

                    b.Property<bool>("EnableLocalPassword")
                        .HasColumnType("boolean")
                        .HasColumnName("enable_local_password");

                    b.Property<bool>("EnableNextEpisodeAutoPlay")
                        .HasColumnType("boolean")
                        .HasColumnName("enable_next_episode_auto_play");

                    b.Property<bool>("EnableUserPreferenceAccess")
                        .HasColumnType("boolean")
                        .HasColumnName("enable_user_preference_access");

                    b.Property<bool>("HidePlayedInLatest")
                        .HasColumnType("boolean")
                        .HasColumnName("hide_played_in_latest");

                    b.Property<long>("InternalId")
                        .HasColumnType("bigint")
                        .HasColumnName("internal_id");

                    b.Property<int>("InvalidLoginAttemptCount")
                        .HasColumnType("integer")
                        .HasColumnName("invalid_login_attempt_count");

                    b.Property<DateTime?>("LastActivityDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_activity_date");

                    b.Property<DateTime?>("LastLoginDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_login_date");

                    b.Property<int?>("LoginAttemptsBeforeLockout")
                        .HasColumnType("integer")
                        .HasColumnName("login_attempts_before_lockout");

                    b.Property<int>("MaxActiveSessions")
                        .HasColumnType("integer")
                        .HasColumnName("max_active_sessions");

                    b.Property<int?>("MaxParentalRatingScore")
                        .HasColumnType("integer")
                        .HasColumnName("max_parental_rating_score");

                    b.Property<int?>("MaxParentalRatingSubScore")
                        .HasColumnType("integer")
                        .HasColumnName("max_parental_rating_sub_score");

                    b.Property<bool>("MustUpdatePassword")
                        .HasColumnType("boolean")
                        .HasColumnName("must_update_password");

                    b.Property<string>("Password")
                        .HasMaxLength(65535)
                        .HasColumnType("character varying(65535)")
                        .HasColumnName("password");

                    b.Property<string>("PasswordResetProviderId")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("password_reset_provider_id");

                    b.Property<bool>("PlayDefaultAudioTrack")
                        .HasColumnType("boolean")
                        .HasColumnName("play_default_audio_track");

                    b.Property<bool>("RememberAudioSelections")
                        .HasColumnType("boolean")
                        .HasColumnName("remember_audio_selections");

                    b.Property<bool>("RememberSubtitleSelections")
                        .HasColumnType("boolean")
                        .HasColumnName("remember_subtitle_selections");

                    b.Property<int?>("RemoteClientBitrateLimit")
                        .HasColumnType("integer")
                        .HasColumnName("remote_client_bitrate_limit");

                    b.Property<long>("RowVersion")
                        .IsConcurrencyToken()
                        .HasColumnType("bigint")
                        .HasColumnName("row_version");

                    b.Property<string>("SubtitleLanguagePreference")
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("subtitle_language_preference");

                    b.Property<int>("SubtitleMode")
                        .HasColumnType("integer")
                        .HasColumnName("subtitle_mode");

                    b.Property<int>("SyncPlayAccess")
                        .HasColumnType("integer")
                        .HasColumnName("sync_play_access");

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("username");

                    b.HasKey("Id");

                    b.HasIndex("Username")
                        .IsUnique();

                    b.ToTable("users", "users");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<string>("CustomDataKey")
                        .HasColumnType("text")
                        .HasColumnName("custom_data_key");

                    b.Property<int?>("AudioStreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("audio_stream_index");

                    b.Property<bool>("IsFavorite")
                        .HasColumnType("boolean")
                        .HasColumnName("is_favorite");

                    b.Property<DateTime?>("LastPlayedDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_played_date");

                    b.Property<bool?>("Likes")
                        .HasColumnType("boolean")
                        .HasColumnName("likes");

                    b.Property<int>("PlayCount")
                        .HasColumnType("integer")
                        .HasColumnName("play_count");

                    b.Property<long>("PlaybackPositionTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("playback_position_ticks");

                    b.Property<bool>("Played")
                        .HasColumnType("boolean")
                        .HasColumnName("played");

                    b.Property<double?>("Rating")
                        .HasColumnType("double precision")
                        .HasColumnName("rating");

                    b.Property<DateTime?>("RetentionDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("retention_date");

                    b.Property<long>("RowVersion")
                        .IsConcurrencyToken()
                        .HasColumnType("bigint")
                        .HasColumnName("row_version");

                    b.Property<int?>("SubtitleStreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("subtitle_stream_index");

                    b.HasKey("ItemId", "UserId", "CustomDataKey");

                    b.HasIndex("UserId");

                    b.HasIndex("ItemId", "UserId", "IsFavorite");

                    b.HasIndex("ItemId", "UserId", "LastPlayedDate");

                    b.HasIndex("ItemId", "UserId", "PlaybackPositionTicks");

                    b.HasIndex("ItemId", "UserId", "Played");

                    b.ToTable("user_data", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.VideoStreamDetails", b =>
                {
                    b.Property<Guid>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<int>("StreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("stream_index");

                    b.Property<string>("AspectRatio")
                        .HasColumnType("text")
                        .HasColumnName("aspect_ratio");

                    b.Property<float?>("AverageFrameRate")
                        .HasColumnType("real")
                        .HasColumnName("average_frame_rate");

                    b.Property<int?>("BitDepth")
                        .HasColumnType("integer")
                        .HasColumnName("bit_depth");

                    b.Property<int?>("BlPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("bl_present_flag");

                    b.Property<string>("ColorPrimaries")
                        .HasColumnType("text")
                        .HasColumnName("color_primaries");

                    b.Property<string>("ColorSpace")
                        .HasColumnType("text")
                        .HasColumnName("color_space");

                    b.Property<string>("ColorTransfer")
                        .HasColumnType("text")
                        .HasColumnName("color_transfer");

                    b.Property<int?>("DvBlSignalCompatibilityId")
                        .HasColumnType("integer")
                        .HasColumnName("dv_bl_signal_compatibility_id");

                    b.Property<int?>("DvLevel")
                        .HasColumnType("integer")
                        .HasColumnName("dv_level");

                    b.Property<int?>("DvProfile")
                        .HasColumnType("integer")
                        .HasColumnName("dv_profile");

                    b.Property<int?>("DvVersionMajor")
                        .HasColumnType("integer")
                        .HasColumnName("dv_version_major");

                    b.Property<int?>("DvVersionMinor")
                        .HasColumnType("integer")
                        .HasColumnName("dv_version_minor");

                    b.Property<int?>("ElPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("el_present_flag");

                    b.Property<bool?>("Hdr10PlusPresentFlag")
                        .HasColumnType("boolean")
                        .HasColumnName("hdr10_plus_present_flag");

                    b.Property<int?>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<bool?>("IsAnamorphic")
                        .HasColumnType("boolean")
                        .HasColumnName("is_anamorphic");

                    b.Property<bool?>("IsInterlaced")
                        .HasColumnType("boolean")
                        .HasColumnName("is_interlaced");

                    b.Property<string>("KeyFrames")
                        .HasColumnType("text")
                        .HasColumnName("key_frames");

                    b.Property<string>("NalLengthSize")
                        .HasColumnType("text")
                        .HasColumnName("nal_length_size");

                    b.Property<string>("PixelFormat")
                        .HasColumnType("text")
                        .HasColumnName("pixel_format");

                    b.Property<float?>("RealFrameRate")
                        .HasColumnType("real")
                        .HasColumnName("real_frame_rate");

                    b.Property<int?>("RefFrames")
                        .HasColumnType("integer")
                        .HasColumnName("ref_frames");

                    b.Property<int?>("Rotation")
                        .HasColumnType("integer")
                        .HasColumnName("rotation");

                    b.Property<int?>("RpuPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("rpu_present_flag");

                    b.Property<int?>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.HasKey("ItemId", "StreamIndex");

                    b.ToTable("video_stream_details", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.ItemPersonView", b =>
                {
                    b.Property<Guid?>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("ItemName")
                        .HasColumnType("text")
                        .HasColumnName("item_name");

                    b.Property<string>("ItemType")
                        .HasColumnType("text")
                        .HasColumnName("item_type");

                    b.Property<int?>("ListOrder")
                        .HasColumnType("integer")
                        .HasColumnName("list_order");

                    b.Property<Guid?>("PersonId")
                        .HasColumnType("uuid")
                        .HasColumnName("person_id");

                    b.Property<string>("PersonName")
                        .HasColumnType("text")
                        .HasColumnName("person_name");

                    b.Property<string>("PersonType")
                        .HasColumnType("text")
                        .HasColumnName("person_type");

                    b.Property<int?>("ProductionYear")
                        .HasColumnType("integer")
                        .HasColumnName("production_year");

                    b.Property<string>("Role")
                        .HasColumnType("text")
                        .HasColumnName("role");

                    b.Property<string>("SeriesName")
                        .HasColumnType("text")
                        .HasColumnName("series_name");

                    b.Property<int?>("SortOrder")
                        .HasColumnType("integer")
                        .HasColumnName("sort_order");

                    b.ToTable((string)null);

                    b.ToView("item_people_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.ItemProviderView", b =>
                {
                    b.Property<int?>("EpisodeNumber")
                        .HasColumnType("integer")
                        .HasColumnName("episode_number");

                    b.Property<string>("ImdbId")
                        .HasColumnType("text")
                        .HasColumnName("imdb_id");

                    b.Property<Guid?>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("MusicBrainzAlbumId")
                        .HasColumnType("text")
                        .HasColumnName("music_brainz_album_id");

                    b.Property<string>("MusicBrainzArtistId")
                        .HasColumnType("text")
                        .HasColumnName("music_brainz_artist_id");

                    b.Property<string>("Name")
                        .HasColumnType("text")
                        .HasColumnName("name");

                    b.Property<string>("OriginalTitle")
                        .HasColumnType("text")
                        .HasColumnName("original_title");

                    b.Property<string>("OtherProviders")
                        .HasColumnType("text")
                        .HasColumnName("other_providers");

                    b.Property<int?>("ProductionYear")
                        .HasColumnType("integer")
                        .HasColumnName("production_year");

                    b.Property<int?>("SeasonNumber")
                        .HasColumnType("integer")
                        .HasColumnName("season_number");

                    b.Property<string>("SeriesName")
                        .HasColumnType("text")
                        .HasColumnName("series_name");

                    b.Property<string>("TmdbId")
                        .HasColumnType("text")
                        .HasColumnName("tmdb_id");

                    b.Property<string>("TvRageId")
                        .HasColumnType("text")
                        .HasColumnName("tv_rage_id");

                    b.Property<string>("TvdbId")
                        .HasColumnType("text")
                        .HasColumnName("tvdb_id");

                    b.Property<string>("Type")
                        .HasColumnType("text")
                        .HasColumnName("type");

                    b.ToTable((string)null);

                    b.ToView("item_providers_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.LibrarySummaryView", b =>
                {
                    b.Property<decimal?>("AvgCommunityRating")
                        .HasColumnType("numeric")
                        .HasColumnName("avg_community_rating");

                    b.Property<long?>("Count1080p")
                        .HasColumnType("bigint")
                        .HasColumnName("count1080p");

                    b.Property<long?>("Count4K")
                        .HasColumnType("bigint")
                        .HasColumnName("count4_k");

                    b.Property<long?>("Count720p")
                        .HasColumnType("bigint")
                        .HasColumnName("count720p");

                    b.Property<long?>("CountDolbyVision")
                        .HasColumnType("bigint")
                        .HasColumnName("count_dolby_vision");

                    b.Property<long?>("CountHDR10")
                        .HasColumnType("bigint")
                        .HasColumnName("count_hdr10");

                    b.Property<long?>("CountHDR10Plus")
                        .HasColumnType("bigint")
                        .HasColumnName("count_hdr10_plus");

                    b.Property<long?>("CountSD")
                        .HasColumnType("bigint")
                        .HasColumnName("count_sd");

                    b.Property<long?>("ItemCount")
                        .HasColumnType("bigint")
                        .HasColumnName("item_count");

                    b.Property<int?>("NewestYear")
                        .HasColumnType("integer")
                        .HasColumnName("newest_year");

                    b.Property<int?>("OldestYear")
                        .HasColumnType("integer")
                        .HasColumnName("oldest_year");

                    b.Property<decimal?>("TotalRunTimeTicks")
                        .HasColumnType("numeric")
                        .HasColumnName("total_run_time_ticks");

                    b.Property<decimal?>("TotalRuntimeHours")
                        .HasColumnType("numeric")
                        .HasColumnName("total_runtime_hours");

                    b.Property<decimal?>("TotalSizeBytes")
                        .HasColumnType("numeric")
                        .HasColumnName("total_size_bytes");

                    b.Property<decimal?>("TotalSizeGB")
                        .HasColumnType("numeric")
                        .HasColumnName("total_size_gb");

                    b.Property<string>("Type")
                        .HasColumnType("text")
                        .HasColumnName("type");

                    b.Property<long?>("WithYear")
                        .HasColumnType("bigint")
                        .HasColumnName("with_year");

                    b.ToTable((string)null);

                    b.ToView("library_summary_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.MediaStreamInfoView", b =>
                {
                    b.Property<string>("AspectRatio")
                        .HasColumnType("text")
                        .HasColumnName("aspect_ratio");

                    b.Property<float?>("AverageFrameRate")
                        .HasColumnType("real")
                        .HasColumnName("average_frame_rate");

                    b.Property<int?>("BitDepth")
                        .HasColumnType("integer")
                        .HasColumnName("bit_depth");

                    b.Property<int?>("BitRate")
                        .HasColumnType("integer")
                        .HasColumnName("bit_rate");

                    b.Property<int?>("BlPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("bl_present_flag");

                    b.Property<string>("ChannelLayout")
                        .HasColumnType("text")
                        .HasColumnName("channel_layout");

                    b.Property<int?>("Channels")
                        .HasColumnType("integer")
                        .HasColumnName("channels");

                    b.Property<string>("Codec")
                        .HasColumnType("text")
                        .HasColumnName("codec");

                    b.Property<string>("CodecTag")
                        .HasColumnType("text")
                        .HasColumnName("codec_tag");

                    b.Property<string>("CodecTimeBase")
                        .HasColumnType("text")
                        .HasColumnName("codec_time_base");

                    b.Property<string>("ColorPrimaries")
                        .HasColumnType("text")
                        .HasColumnName("color_primaries");

                    b.Property<string>("ColorSpace")
                        .HasColumnType("text")
                        .HasColumnName("color_space");

                    b.Property<string>("ColorTransfer")
                        .HasColumnType("text")
                        .HasColumnName("color_transfer");

                    b.Property<string>("Comment")
                        .HasColumnType("text")
                        .HasColumnName("comment");

                    b.Property<int?>("DvBlSignalCompatibilityId")
                        .HasColumnType("integer")
                        .HasColumnName("dv_bl_signal_compatibility_id");

                    b.Property<int?>("DvLevel")
                        .HasColumnType("integer")
                        .HasColumnName("dv_level");

                    b.Property<int?>("DvProfile")
                        .HasColumnType("integer")
                        .HasColumnName("dv_profile");

                    b.Property<int?>("DvVersionMajor")
                        .HasColumnType("integer")
                        .HasColumnName("dv_version_major");

                    b.Property<int?>("DvVersionMinor")
                        .HasColumnType("integer")
                        .HasColumnName("dv_version_minor");

                    b.Property<int?>("ElPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("el_present_flag");

                    b.Property<bool?>("Hdr10PlusPresentFlag")
                        .HasColumnType("boolean")
                        .HasColumnName("hdr10_plus_present_flag");

                    b.Property<int?>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<bool?>("IsAnamorphic")
                        .HasColumnType("boolean")
                        .HasColumnName("is_anamorphic");

                    b.Property<bool?>("IsAvc")
                        .HasColumnType("boolean")
                        .HasColumnName("is_avc");

                    b.Property<bool?>("IsDefault")
                        .HasColumnType("boolean")
                        .HasColumnName("is_default");

                    b.Property<bool?>("IsExternal")
                        .HasColumnType("boolean")
                        .HasColumnName("is_external");

                    b.Property<bool?>("IsForced")
                        .HasColumnType("boolean")
                        .HasColumnName("is_forced");

                    b.Property<bool?>("IsHearingImpaired")
                        .HasColumnType("boolean")
                        .HasColumnName("is_hearing_impaired");

                    b.Property<bool?>("IsInterlaced")
                        .HasColumnType("boolean")
                        .HasColumnName("is_interlaced");

                    b.Property<Guid?>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("KeyFrames")
                        .HasColumnType("text")
                        .HasColumnName("key_frames");

                    b.Property<string>("Language")
                        .HasColumnType("text")
                        .HasColumnName("language");

                    b.Property<float?>("Level")
                        .HasColumnType("real")
                        .HasColumnName("level");

                    b.Property<string>("NalLengthSize")
                        .HasColumnType("text")
                        .HasColumnName("nal_length_size");

                    b.Property<string>("Path")
                        .HasColumnType("text")
                        .HasColumnName("path");

                    b.Property<string>("PixelFormat")
                        .HasColumnType("text")
                        .HasColumnName("pixel_format");

                    b.Property<string>("Profile")
                        .HasColumnType("text")
                        .HasColumnName("profile");

                    b.Property<float?>("RealFrameRate")
                        .HasColumnType("real")
                        .HasColumnName("real_frame_rate");

                    b.Property<int?>("RefFrames")
                        .HasColumnType("integer")
                        .HasColumnName("ref_frames");

                    b.Property<int?>("Rotation")
                        .HasColumnType("integer")
                        .HasColumnName("rotation");

                    b.Property<int?>("RpuPresentFlag")
                        .HasColumnType("integer")
                        .HasColumnName("rpu_present_flag");

                    b.Property<int?>("SampleRate")
                        .HasColumnType("integer")
                        .HasColumnName("sample_rate");

                    b.Property<int?>("StreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("stream_index");

                    b.Property<int?>("StreamType")
                        .HasColumnType("integer")
                        .HasColumnName("stream_type");

                    b.Property<string>("TimeBase")
                        .HasColumnType("text")
                        .HasColumnName("time_base");

                    b.Property<string>("Title")
                        .HasColumnType("text")
                        .HasColumnName("title");

                    b.Property<int?>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.ToTable((string)null);

                    b.ToView("media_stream_infos_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.UserPlaybackHistoryView", b =>
                {
                    b.Property<int?>("AudioStreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("audio_stream_index");

                    b.Property<int?>("EpisodeNumber")
                        .HasColumnType("integer")
                        .HasColumnName("episode_number");

                    b.Property<bool?>("IsFavorite")
                        .HasColumnType("boolean")
                        .HasColumnName("is_favorite");

                    b.Property<Guid?>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("ItemName")
                        .HasColumnType("text")
                        .HasColumnName("item_name");

                    b.Property<string>("ItemType")
                        .HasColumnType("text")
                        .HasColumnName("item_type");

                    b.Property<DateTimeOffset?>("LastPlayedDate")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_played_date");

                    b.Property<int?>("PlayCount")
                        .HasColumnType("integer")
                        .HasColumnName("play_count");

                    b.Property<long?>("PlaybackPositionTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("playback_position_ticks");

                    b.Property<bool?>("Played")
                        .HasColumnType("boolean")
                        .HasColumnName("played");

                    b.Property<int?>("ProductionYear")
                        .HasColumnType("integer")
                        .HasColumnName("production_year");

                    b.Property<decimal?>("ProgressPct")
                        .HasColumnType("numeric")
                        .HasColumnName("progress_pct");

                    b.Property<double?>("Rating")
                        .HasColumnType("double precision")
                        .HasColumnName("rating");

                    b.Property<long?>("RunTimeTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("run_time_ticks");

                    b.Property<string>("SeasonName")
                        .HasColumnType("text")
                        .HasColumnName("season_name");

                    b.Property<int?>("SeasonNumber")
                        .HasColumnType("integer")
                        .HasColumnName("season_number");

                    b.Property<string>("SeriesName")
                        .HasColumnType("text")
                        .HasColumnName("series_name");

                    b.Property<int?>("SubtitleStreamIndex")
                        .HasColumnType("integer")
                        .HasColumnName("subtitle_stream_index");

                    b.Property<Guid?>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.Property<string>("Username")
                        .HasColumnType("text")
                        .HasColumnName("username");

                    b.ToTable((string)null);

                    b.ToView("user_playback_history_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Views.VideoItemView", b =>
                {
                    b.Property<string>("AspectRatio")
                        .HasColumnType("text")
                        .HasColumnName("aspect_ratio");

                    b.Property<long?>("AudioTrackCount")
                        .HasColumnType("bigint")
                        .HasColumnName("audio_track_count");

                    b.Property<float?>("AverageFrameRate")
                        .HasColumnType("real")
                        .HasColumnName("average_frame_rate");

                    b.Property<int?>("BitDepth")
                        .HasColumnType("integer")
                        .HasColumnName("bit_depth");

                    b.Property<string>("ColorPrimaries")
                        .HasColumnType("text")
                        .HasColumnName("color_primaries");

                    b.Property<string>("ColorSpace")
                        .HasColumnType("text")
                        .HasColumnName("color_space");

                    b.Property<string>("ColorTransfer")
                        .HasColumnType("text")
                        .HasColumnName("color_transfer");

                    b.Property<float?>("CommunityRating")
                        .HasColumnType("real")
                        .HasColumnName("community_rating");

                    b.Property<DateTimeOffset?>("DateCreated")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_created");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date_modified");

                    b.Property<int?>("EpisodeNumber")
                        .HasColumnType("integer")
                        .HasColumnName("episode_number");

                    b.Property<string>("HDRFormat")
                        .HasColumnType("text")
                        .HasColumnName("hdr_format");

                    b.Property<int?>("Height")
                        .HasColumnType("integer")
                        .HasColumnName("height");

                    b.Property<bool?>("IsAnamorphic")
                        .HasColumnType("boolean")
                        .HasColumnName("is_anamorphic");

                    b.Property<bool?>("IsDolbyVision")
                        .HasColumnType("boolean")
                        .HasColumnName("is_dolby_vision");

                    b.Property<bool?>("IsHDR10Plus")
                        .HasColumnType("boolean")
                        .HasColumnName("is_hdr10_plus");

                    b.Property<bool?>("IsInterlaced")
                        .HasColumnType("boolean")
                        .HasColumnName("is_interlaced");

                    b.Property<Guid?>("ItemId")
                        .HasColumnType("uuid")
                        .HasColumnName("item_id");

                    b.Property<string>("Name")
                        .HasColumnType("text")
                        .HasColumnName("name");

                    b.Property<string>("OfficialRating")
                        .HasColumnType("text")
                        .HasColumnName("official_rating");

                    b.Property<string>("OriginalTitle")
                        .HasColumnType("text")
                        .HasColumnName("original_title");

                    b.Property<string>("Path")
                        .HasColumnType("text")
                        .HasColumnName("path");

                    b.Property<string>("PixelFormat")
                        .HasColumnType("text")
                        .HasColumnName("pixel_format");

                    b.Property<int?>("ProductionYear")
                        .HasColumnType("integer")
                        .HasColumnName("production_year");

                    b.Property<long?>("RunTimeTicks")
                        .HasColumnType("bigint")
                        .HasColumnName("run_time_ticks");

                    b.Property<string>("SeasonName")
                        .HasColumnType("text")
                        .HasColumnName("season_name");

                    b.Property<int?>("SeasonNumber")
                        .HasColumnType("integer")
                        .HasColumnName("season_number");

                    b.Property<string>("SeriesName")
                        .HasColumnType("text")
                        .HasColumnName("series_name");

                    b.Property<long?>("Size")
                        .HasColumnType("bigint")
                        .HasColumnName("size");

                    b.Property<long?>("SubtitleTrackCount")
                        .HasColumnType("bigint")
                        .HasColumnName("subtitle_track_count");

                    b.Property<int?>("TotalBitrate")
                        .HasColumnType("integer")
                        .HasColumnName("total_bitrate");

                    b.Property<string>("Type")
                        .HasColumnType("text")
                        .HasColumnName("type");

                    b.Property<string>("VideoCodec")
                        .HasColumnType("text")
                        .HasColumnName("video_codec");

                    b.Property<string>("VideoProfile")
                        .HasColumnType("text")
                        .HasColumnName("video_profile");

                    b.Property<int?>("Width")
                        .HasColumnType("integer")
                        .HasColumnName("width");

                    b.ToTable((string)null);

                    b.ToView("video_items_v", "library");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AccessSchedule", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithMany("AccessSchedules")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("Parents")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "ParentItem")
                        .WithMany("Children")
                        .HasForeignKey("ParentItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("ParentItem");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AttachmentStreamInfo", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AudioStreamDetails", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", "Stream")
                        .WithOne("AudioDetails")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.AudioStreamDetails", "ItemId", "StreamIndex")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Stream");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemAudioExtras", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithOne("AudioExtras")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.BaseItemAudioExtras", "ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "DirectParent")
                        .WithMany("DirectChildren")
                        .HasForeignKey("ParentId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.Navigation("DirectParent");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemImageInfo", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("Images")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemLiveTvExtras", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithOne("LiveTvExtras")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.BaseItemLiveTvExtras", "ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemMetadataField", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("LockedFields")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemProvider", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("Provider")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTrailerType", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("TrailerTypes")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemTvExtras", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithOne("TvExtras")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.BaseItemTvExtras", "ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Chapter", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("Chapters")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithMany("DisplayPreferences")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.HomeSection", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.DisplayPreferences", null)
                        .WithMany("HomeSections")
                        .HasForeignKey("DisplayPreferencesId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ImageInfo", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithOne("ProfileImage")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.ImageInfo", "UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemDisplayPreferences", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithMany("ItemDisplayPreferences")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValueMap", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("ItemValues")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Jellyfin.Database.Implementations.Entities.ItemValue", "ItemValue")
                        .WithMany("BaseItemsMap")
                        .HasForeignKey("ItemValueId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("ItemValue");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.KeyframeData", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("MediaStreams")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.PeopleBaseItemMap", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("Peoples")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Jellyfin.Database.Implementations.Entities.People", "People")
                        .WithMany("BaseItems")
                        .HasForeignKey("PeopleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("People");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Permission", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithMany("Permissions")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Preference", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", null)
                        .WithMany("Preferences")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.Security.Device", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.UserData", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
                        .WithMany("UserData")
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Jellyfin.Database.Implementations.Entities.User", "User")
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Item");

                    b.Navigation("User");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.VideoStreamDetails", b =>
                {
                    b.HasOne("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", "Stream")
                        .WithOne("VideoDetails")
                        .HasForeignKey("Jellyfin.Database.Implementations.Entities.VideoStreamDetails", "ItemId", "StreamIndex")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Stream");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.BaseItemEntity", b =>
                {
                    b.Navigation("AudioExtras");

                    b.Navigation("Chapters");

                    b.Navigation("Children");

                    b.Navigation("DirectChildren");

                    b.Navigation("Images");

                    b.Navigation("ItemValues");

                    b.Navigation("LiveTvExtras");

                    b.Navigation("LockedFields");

                    b.Navigation("MediaStreams");

                    b.Navigation("Parents");

                    b.Navigation("Peoples");

                    b.Navigation("Provider");

                    b.Navigation("TrailerTypes");

                    b.Navigation("TvExtras");

                    b.Navigation("UserData");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.DisplayPreferences", b =>
                {
                    b.Navigation("HomeSections");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.ItemValue", b =>
                {
                    b.Navigation("BaseItemsMap");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.MediaStreamInfo", b =>
                {
                    b.Navigation("AudioDetails");

                    b.Navigation("VideoDetails");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.People", b =>
                {
                    b.Navigation("BaseItems");
                });

            modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.User", b =>
                {
                    b.Navigation("AccessSchedules");

                    b.Navigation("DisplayPreferences");

                    b.Navigation("ItemDisplayPreferences");

                    b.Navigation("Permissions");

                    b.Navigation("Preferences");

                    b.Navigation("ProfileImage");
                });
#pragma warning restore 612, 618
        }
    }
}
