diff --git a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/CrashReportIgnoredFileIdEntityConfiguration.cs b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/CrashReportIgnoredFileIdEntityConfiguration.cs index 7a070ebc..38b1ec0a 100644 --- a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/CrashReportIgnoredFileIdEntityConfiguration.cs +++ b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/CrashReportIgnoredFileIdEntityConfiguration.cs @@ -12,7 +12,7 @@ public CrashReportIgnoredFileIdEntityConfiguration(ITenantContextAccessor tenant protected override void ConfigureModel(EntityTypeBuilder builder) { - builder.Property(x => x.CrashReportFileId).HasColumnName("crash_report_file_ignored_id").HasVogenConversion().ValueGeneratedOnAdd(); + builder.Property(x => x.CrashReportFileId).HasColumnName("crash_report_file_ignored_id").HasVogenConversion(); builder.ToTable("crash_report_file_ignored", "crashreport").HasKey(x => new { x.TenantId, Value = x.CrashReportFileId }); base.ConfigureModel(builder); diff --git a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToRoleEntityConfiguration.cs b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToRoleEntityConfiguration.cs index 061570ce..490a2319 100644 --- a/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToRoleEntityConfiguration.cs +++ b/src/BUTR.Site.NexusMods.Server/Contexts/Configs/NexusModsUserToRoleEntityConfiguration.cs @@ -14,7 +14,6 @@ protected override void ConfigureModel(EntityTypeBuilder x.NexusModsUserId).HasColumnName("nexusmods_user_role_id").HasVogenConversion().ValueGeneratedNever(); builder.Property(x => x.Role).HasColumnName("role").HasVogenConversion(); - builder.Property(x => x.TenantId).HasColumnName("tenant").HasVogenConversion(); builder.ToTable("nexusmods_user_role", "nexusmods_user").HasKey(x => new { x.TenantId, diff --git a/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.Designer.cs b/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.Designer.cs new file mode 100644 index 00000000..22aa5fc0 --- /dev/null +++ b/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.Designer.cs @@ -0,0 +1,1615 @@ +// +using System; +using System.Collections.Generic; +using BUTR.Site.NexusMods.Server.Contexts; +using BUTR.Site.NexusMods.Server.Models.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace BUTR.Site.NexusMods.Server.Migrations +{ + [DbContext(typeof(BaseAppDbContext))] + [Migration("20240922204611_NewMetadata")] + partial class NewMetadata + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "hstore"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.HasSequence("quartz_log_id_seq", "quartz"); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.AutocompleteEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("AutocompleteId") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("autocomplete_id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AutocompleteId")); + + b.Property("Type") + .IsRequired() + .HasColumnType("text") + .HasColumnName("type"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("TenantId", "AutocompleteId"); + + b.HasIndex("Type"); + + b.ToTable("autocomplete", "autocomplete"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("CrashReportId") + .HasColumnType("uuid") + .HasColumnName("crash_report_id"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_at"); + + b.Property("Exception") + .IsRequired() + .HasColumnType("text") + .HasColumnName("exception"); + + b.Property("ExceptionTypeId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("exception_type_id"); + + b.Property("GameVersion") + .IsRequired() + .HasColumnType("text") + .HasColumnName("game_version"); + + b.Property("Url") + .IsRequired() + .HasColumnType("text") + .HasColumnName("url"); + + b.Property("Version") + .HasColumnType("smallint") + .HasColumnName("version"); + + b.HasKey("TenantId", "CrashReportId"); + + b.HasIndex("TenantId", "ExceptionTypeId"); + + b.ToTable("crash_report", "crashreport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportIgnoredFileEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("CrashReportFileId") + .HasColumnType("text") + .HasColumnName("crash_report_file_ignored_id"); + + b.HasKey("TenantId", "CrashReportFileId"); + + b.ToTable("crash_report_file_ignored", "crashreport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToFileIdEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("CrashReportId") + .HasColumnType("uuid") + .HasColumnName("crash_report_file_id"); + + b.Property("FileId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("file_id"); + + b.HasKey("TenantId", "CrashReportId"); + + b.ToTable("crash_report_file", "crashreport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToMetadataEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("CrashReportId") + .HasColumnType("uuid") + .HasColumnName("crash_report_metadata_id"); + + b.Property("BLSEVersion") + .HasColumnType("text") + .HasColumnName("blse_version"); + + b.Property("BUTRLoaderVersion") + .HasColumnType("text") + .HasColumnName("butrloader_version"); + + b.Property("LauncherExVersion") + .HasColumnType("text") + .HasColumnName("launcherex_version"); + + b.Property("LauncherType") + .HasColumnType("text") + .HasColumnName("launcher_type"); + + b.Property("LauncherVersion") + .HasColumnType("text") + .HasColumnName("launcher_version"); + + b.Property("OperatingSystemType") + .HasColumnType("text") + .HasColumnName("operating_system_type"); + + b.Property("OperatingSystemVersion") + .HasColumnType("text") + .HasColumnName("operating_system_version"); + + b.Property("Runtime") + .HasColumnType("text") + .HasColumnName("runtime"); + + b.HasKey("TenantId", "CrashReportId"); + + b.ToTable("crash_report_metadata", "crashreport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToModuleMetadataEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("CrashReportId") + .HasColumnType("uuid") + .HasColumnName("crash_report_module_info_id"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("InvolvedPosition") + .HasColumnType("smallint") + .HasColumnName("involved_position"); + + b.Property("IsInvolved") + .HasColumnType("boolean") + .HasColumnName("is_involved"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_id"); + + b.Property("Version") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version"); + + b.HasKey("TenantId", "CrashReportId", "ModuleId"); + + b.HasIndex("TenantId", "ModuleId"); + + b.HasIndex("TenantId", "NexusModsModId"); + + b.ToTable("crash_report_module_info", "crashreport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ExceptionTypeEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("ExceptionTypeId") + .HasColumnType("text") + .HasColumnName("exception_type_id"); + + b.HasKey("TenantId", "ExceptionTypeId"); + + b.ToTable("exception_type", "exception"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationDiscordTokensEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("integration_discord_tokens_id"); + + b.Property("AccessToken") + .IsRequired() + .HasColumnType("text") + .HasColumnName("access_token"); + + b.Property("AccessTokenExpiresAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("access_token_expires_at"); + + b.Property("DiscordUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("discord_user_id"); + + b.Property("RefreshToken") + .IsRequired() + .HasColumnType("text") + .HasColumnName("refresh_token"); + + b.HasKey("NexusModsUserId"); + + b.HasIndex("DiscordUserId") + .IsUnique(); + + b.ToTable("integration_discord_tokens", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGToOwnedTenantEntity", b => + { + b.Property("GOGUserId") + .HasColumnType("text") + .HasColumnName("integration_gog_owned_tenant_id"); + + b.Property("OwnedTenant") + .HasColumnType("smallint") + .HasColumnName("owned_tenant"); + + b.HasKey("GOGUserId", "OwnedTenant"); + + b.HasIndex("OwnedTenant"); + + b.ToTable("integration_gog_owned_tenant", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGTokensEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("integration_gog_tokens_id"); + + b.Property("AccessToken") + .IsRequired() + .HasColumnType("text") + .HasColumnName("access_token"); + + b.Property("AccessTokenExpiresAt") + .HasColumnType("timestamp with time zone") + .HasColumnName("access_token_expires_at"); + + b.Property("GOGUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("gog_user_id"); + + b.Property("RefreshToken") + .IsRequired() + .HasColumnType("text") + .HasColumnName("refresh_token"); + + b.HasKey("NexusModsUserId"); + + b.HasIndex("GOGUserId") + .IsUnique(); + + b.ToTable("integration_gog_tokens", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGitHubTokensEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("integration_github_tokens_id"); + + b.Property("AccessToken") + .IsRequired() + .HasColumnType("text") + .HasColumnName("access_token"); + + b.Property("GitHubUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("github_user_id"); + + b.HasKey("NexusModsUserId"); + + b.HasIndex("GitHubUserId") + .IsUnique(); + + b.ToTable("integration_github_tokens", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamToOwnedTenantEntity", b => + { + b.Property("SteamUserId") + .HasColumnType("text") + .HasColumnName("integration_steam_owned_tenant_id"); + + b.Property("OwnedTenant") + .HasColumnType("smallint") + .HasColumnName("owned_tenant"); + + b.HasKey("SteamUserId", "OwnedTenant"); + + b.HasIndex("OwnedTenant"); + + b.ToTable("integration_steam_owned_tenant", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamTokensEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("integration_steam_tokens_id"); + + b.Property>("Data") + .IsRequired() + .HasColumnType("hstore") + .HasColumnName("data"); + + b.Property("SteamUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("steam_user_id"); + + b.HasKey("NexusModsUserId"); + + b.HasIndex("SteamUserId") + .IsUnique(); + + b.ToTable("integration_steam_tokens", "integration"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.HasKey("TenantId", "ModuleId"); + + b.ToTable("module", "module"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsArticleEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsArticleId") + .HasColumnType("integer") + .HasColumnName("nexusmods_article_entity_id"); + + b.Property("CreateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("create_date"); + + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("author_id"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasColumnName("title"); + + b.HasKey("TenantId", "NexusModsArticleId"); + + b.HasIndex("NexusModsUserId"); + + b.ToTable("nexusmods_article_entity", "nexusmods_article"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_id"); + + b.HasKey("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_mod", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToFileUpdateEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_file_update_id"); + + b.Property("LastCheckedDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_of_last_check"); + + b.HasKey("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_mod_file_update", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_module_id"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("LinkType") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_module_link_type_id"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_of_last_update"); + + b.HasKey("TenantId", "NexusModsModId", "ModuleId", "LinkType"); + + b.HasIndex("TenantId", "ModuleId"); + + b.ToTable("nexusmods_mod_module", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsFileId") + .HasColumnType("integer") + .HasColumnName("nexusmods_file_id"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_module_info_history_id"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("ModuleVersion") + .HasColumnType("text") + .HasColumnName("module_version"); + + b.Property("ModuleInfo") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("module_info"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_of_upload"); + + b.HasKey("TenantId", "NexusModsFileId", "NexusModsModId", "ModuleId", "ModuleVersion"); + + b.HasIndex("TenantId", "ModuleId"); + + b.HasIndex("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_mod_module_info_history", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryGameVersionEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsFileId") + .HasColumnType("integer") + .HasColumnName("nexusmods_file_id"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_module_info_history_game_version_id"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("ModuleVersion") + .HasColumnType("text") + .HasColumnName("module_version"); + + b.Property("GameVersion") + .IsRequired() + .HasColumnType("text") + .HasColumnName("game_version"); + + b.HasKey("TenantId", "NexusModsFileId", "NexusModsModId", "ModuleId", "ModuleVersion"); + + b.HasIndex("TenantId", "ModuleId"); + + b.HasIndex("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_mod_module_info_history_game_version", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToNameEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_name_id"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_mod_name", "nexusmods_mod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_id"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToCrashReportEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_crash_report_id"); + + b.Property("CrashReportId") + .HasColumnType("uuid") + .HasColumnName("crash_report_id"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text") + .HasColumnName("comment"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.HasKey("TenantId", "NexusModsUserId", "CrashReportId"); + + b.HasIndex("NexusModsUserId"); + + b.HasIndex("TenantId", "CrashReportId"); + + b.ToTable("nexusmods_user_crash_report", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_to_discord_id"); + + b.Property("DiscordUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("discord_user_id"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user_to_integration_discord", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_to_gog_id"); + + b.Property("GOGUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("gog_user_id"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user_to_integration_gog", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_to_github_id"); + + b.Property("GitHubUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("github_user_id"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user_to_integration_github", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_to_steam_id"); + + b.Property("SteamUserId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("steam_user_id"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user_to_integration_steam", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToModuleEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_module_id"); + + b.Property("ModuleId") + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("LinkType") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_module_link_type_id"); + + b.HasKey("TenantId", "NexusModsUserId", "ModuleId", "LinkType"); + + b.HasIndex("NexusModsUserId"); + + b.HasIndex("TenantId", "ModuleId"); + + b.ToTable("nexusmods_user_module", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToNameEntity", b => + { + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_name_id"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("NexusModsUserId"); + + b.ToTable("nexusmods_user_name", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToNexusModsModEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_nexusmods_mod_id"); + + b.Property("NexusModsModId") + .HasColumnType("integer") + .HasColumnName("nexusmods_mod_id"); + + b.Property("LinkType") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_nexusmods_mod_link_type_id"); + + b.HasKey("TenantId", "NexusModsUserId", "NexusModsModId", "LinkType"); + + b.HasIndex("NexusModsUserId"); + + b.HasIndex("TenantId", "NexusModsModId"); + + b.ToTable("nexusmods_user_nexusmods_mod", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToRoleEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("NexusModsUserId") + .HasColumnType("integer") + .HasColumnName("nexusmods_user_role_id"); + + b.Property("Role") + .IsRequired() + .HasColumnType("text") + .HasColumnName("role"); + + b.HasKey("TenantId", "NexusModsUserId"); + + b.HasIndex("NexusModsUserId"); + + b.ToTable("nexusmods_user_role", "nexusmods_user"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.QuartzExecutionLogEntity", b => + { + b.Property("RunInstanceId") + .HasColumnType("text") + .HasColumnName("run_instance_id"); + + b.Property("JobName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("job_name"); + + b.Property("JobGroup") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("job_group"); + + b.Property("TriggerName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("trigger_name"); + + b.Property("TriggerGroup") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("trigger_group"); + + b.Property("FireTimeUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("fire_time_utc"); + + b.Property("DateAddedUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_added_utc"); + + b.Property("ErrorMessage") + .HasColumnType("text") + .HasColumnName("error_message"); + + b.Property("ExecutionLogDetail") + .HasColumnType("jsonb") + .HasColumnName("log_detail"); + + b.Property("IsException") + .HasColumnType("boolean") + .HasColumnName("is_exception"); + + b.Property("IsSuccess") + .HasColumnType("boolean") + .HasColumnName("is_success"); + + b.Property("IsVetoed") + .HasColumnType("boolean") + .HasColumnName("is_vetoed"); + + b.Property("JobRunTime") + .HasColumnType("interval") + .HasColumnName("job_run_time"); + + b.Property("LogId") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("quartz_log_id") + .HasDefaultValueSql("nextval('\"quartz\".\"quartz_log_id_seq\"')"); + + b.Property("MachineName") + .HasColumnType("text") + .HasColumnName("machie_name"); + + b.Property("Result") + .HasColumnType("text") + .HasColumnName("result"); + + b.Property("RetryCount") + .HasColumnType("integer") + .HasColumnName("retry_count"); + + b.Property("ReturnCode") + .HasColumnType("text") + .HasColumnName("return_code"); + + b.Property("ScheduleFireTimeUtc") + .HasColumnType("timestamp with time zone") + .HasColumnName("schedule_fire_time_utc"); + + b.HasKey("RunInstanceId", "JobName", "JobGroup", "TriggerName", "TriggerGroup", "FireTimeUtc"); + + b.ToTable("quartz_log", "quartz"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.StatisticsCrashScoreInvolvedEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("StatisticsCrashScoreInvolvedId") + .HasColumnType("uuid") + .HasColumnName("crash_score_involved_id"); + + b.Property("GameVersion") + .IsRequired() + .HasColumnType("text") + .HasColumnName("game_version"); + + b.Property("InvolvedCount") + .HasColumnType("integer") + .HasColumnName("involved_count"); + + b.Property("ModuleId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("module_id"); + + b.Property("ModuleVersion") + .IsRequired() + .HasColumnType("text") + .HasColumnName("module_version"); + + b.Property("NotInvolvedCount") + .HasColumnType("integer") + .HasColumnName("not_involved_count"); + + b.Property("RawValue") + .HasColumnType("integer") + .HasColumnName("value"); + + b.Property("Score") + .HasColumnType("double precision") + .HasColumnName("crash_score"); + + b.Property("TotalCount") + .HasColumnType("integer") + .HasColumnName("total_count"); + + b.HasKey("TenantId", "StatisticsCrashScoreInvolvedId"); + + b.HasIndex("TenantId", "ModuleId"); + + b.ToTable("crash_score_involved", "statistics"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.StatisticsTopExceptionsTypeEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant"); + + b.Property("ExceptionTypeId") + .HasColumnType("text") + .HasColumnName("top_exceptions_type_id"); + + b.Property("ExceptionCount") + .HasColumnType("integer") + .HasColumnName("count"); + + b.HasKey("TenantId", "ExceptionTypeId"); + + b.ToTable("top_exceptions_type", "statistics"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", b => + { + b.Property("TenantId") + .HasColumnType("smallint") + .HasColumnName("tenant_id"); + + b.HasKey("TenantId"); + + b.ToTable("tenant", "tenant"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.AutocompleteEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ExceptionTypeEntity", "ExceptionType") + .WithMany("ToCrashReports") + .HasForeignKey("TenantId", "ExceptionTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExceptionType"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportIgnoredFileEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToFileIdEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", "ToCrashReport") + .WithOne("FileId") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToFileIdEntity", "TenantId", "CrashReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ToCrashReport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToMetadataEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", "ToCrashReport") + .WithOne("Metadata") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToMetadataEntity", "TenantId", "CrashReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ToCrashReport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportToModuleMetadataEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", "ToCrashReport") + .WithMany("ModuleInfos") + .HasForeignKey("TenantId", "CrashReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany() + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithMany() + .HasForeignKey("TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Module"); + + b.Navigation("NexusModsMod"); + + b.Navigation("ToCrashReport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ExceptionTypeEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationDiscordTokensEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", "UserToDiscord") + .WithOne("ToTokens") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationDiscordTokensEntity", "DiscordUserId") + .HasPrincipalKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", "DiscordUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne() + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationDiscordTokensEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + + b.Navigation("UserToDiscord"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGToOwnedTenantEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", null) + .WithMany("ToOwnedTenants") + .HasForeignKey("GOGUserId") + .HasPrincipalKey("GOGUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("OwnedTenant") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGTokensEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", "UserToGOG") + .WithOne("ToTokens") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGTokensEntity", "GOGUserId") + .HasPrincipalKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", "GOGUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne() + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGOGTokensEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + + b.Navigation("UserToGOG"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGitHubTokensEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", "UserToGitHub") + .WithOne("ToTokens") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGitHubTokensEntity", "GitHubUserId") + .HasPrincipalKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", "GitHubUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne() + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationGitHubTokensEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + + b.Navigation("UserToGitHub"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamToOwnedTenantEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("OwnedTenant") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", null) + .WithMany("ToOwnedTenants") + .HasForeignKey("SteamUserId") + .HasPrincipalKey("SteamUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamTokensEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne() + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamTokensEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", "UserToSteam") + .WithOne("ToTokens") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.IntegrationSteamTokensEntity", "SteamUserId") + .HasPrincipalKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", "SteamUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + + b.Navigation("UserToSteam"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsArticleEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithMany("ToArticles") + .HasForeignKey("NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToFileUpdateEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithOne("FileUpdate") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToFileUpdateEntity", "TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsMod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany("ToNexusModsMods") + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithMany("ModuleIds") + .HasForeignKey("TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + + b.Navigation("NexusModsMod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany() + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithMany() + .HasForeignKey("TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + + b.Navigation("NexusModsMod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryGameVersionEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany() + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithMany() + .HasForeignKey("TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryEntity", "MainEntity") + .WithMany("GameVersions") + .HasForeignKey("TenantId", "NexusModsFileId", "NexusModsModId", "ModuleId", "ModuleVersion") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_nexusmods_mod_module_info_history_game_version_nexusmods_m~1"); + + b.Navigation("MainEntity"); + + b.Navigation("Module"); + + b.Navigation("NexusModsMod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToNameEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithOne("Name") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToNameEntity", "TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsMod"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToCrashReportEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithMany("ToCrashReports") + .HasForeignKey("NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", "ToCrashReport") + .WithMany("ToUsers") + .HasForeignKey("TenantId", "CrashReportId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + + b.Navigation("ToCrashReport"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne("ToDiscord") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne("ToGOG") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne("ToGitHub") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne("ToSteam") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToModuleEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithMany("ToModules") + .HasForeignKey("NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany("ToNexusModsUsers") + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToNameEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithOne("Name") + .HasForeignKey("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToNameEntity", "NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToNexusModsModEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithMany("ToNexusModsMods") + .HasForeignKey("NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", "NexusModsMod") + .WithMany("ToNexusModsUsers") + .HasForeignKey("TenantId", "NexusModsModId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsMod"); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToRoleEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", "NexusModsUser") + .WithMany("ToRoles") + .HasForeignKey("NexusModsUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NexusModsUser"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.StatisticsCrashScoreInvolvedEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", "Module") + .WithMany("ToCrashScore") + .HasForeignKey("TenantId", "ModuleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Module"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.StatisticsTopExceptionsTypeEntity", b => + { + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.ExceptionTypeEntity", "ExceptionType") + .WithMany("ToTopExceptionsTypes") + .HasForeignKey("TenantId", "ExceptionTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ExceptionType"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.CrashReportEntity", b => + { + b.Navigation("FileId"); + + b.Navigation("Metadata"); + + b.Navigation("ModuleInfos"); + + b.Navigation("ToUsers"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ExceptionTypeEntity", b => + { + b.Navigation("ToCrashReports"); + + b.Navigation("ToTopExceptionsTypes"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.ModuleEntity", b => + { + b.Navigation("ToCrashScore"); + + b.Navigation("ToNexusModsMods"); + + b.Navigation("ToNexusModsUsers"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModEntity", b => + { + b.Navigation("FileUpdate"); + + b.Navigation("ModuleIds"); + + b.Navigation("Name"); + + b.Navigation("ToNexusModsUsers"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsModToModuleInfoHistoryEntity", b => + { + b.Navigation("GameVersions"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserEntity", b => + { + b.Navigation("Name"); + + b.Navigation("ToArticles"); + + b.Navigation("ToCrashReports"); + + b.Navigation("ToDiscord"); + + b.Navigation("ToGOG"); + + b.Navigation("ToGitHub"); + + b.Navigation("ToModules"); + + b.Navigation("ToNexusModsMods"); + + b.Navigation("ToRoles"); + + b.Navigation("ToSteam"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationDiscordEntity", b => + { + b.Navigation("ToTokens"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGOGEntity", b => + { + b.Navigation("ToOwnedTenants"); + + b.Navigation("ToTokens"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationGitHubEntity", b => + { + b.Navigation("ToTokens"); + }); + + modelBuilder.Entity("BUTR.Site.NexusMods.Server.Models.Database.NexusModsUserToIntegrationSteamEntity", b => + { + b.Navigation("ToOwnedTenants"); + + b.Navigation("ToTokens"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.cs b/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.cs new file mode 100644 index 00000000..86c84337 --- /dev/null +++ b/src/BUTR.Site.NexusMods.Server/Migrations/20240922204611_NewMetadata.cs @@ -0,0 +1,57 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BUTR.Site.NexusMods.Server.Migrations +{ + /// + public partial class NewMetadata : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "operating_system_type", + schema: "crashreport", + table: "crash_report_metadata", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "operating_system_version", + schema: "crashreport", + table: "crash_report_metadata", + type: "text", + nullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_nexusmods_user_role_tenant_tenant", + schema: "nexusmods_user", + table: "nexusmods_user_role", + column: "tenant", + principalSchema: "tenant", + principalTable: "tenant", + principalColumn: "tenant_id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_nexusmods_user_role_tenant_tenant", + schema: "nexusmods_user", + table: "nexusmods_user_role"); + + migrationBuilder.DropColumn( + name: "operating_system_type", + schema: "crashreport", + table: "crash_report_metadata"); + + migrationBuilder.DropColumn( + name: "operating_system_version", + schema: "crashreport", + table: "crash_report_metadata"); + } + } +} diff --git a/src/BUTR.Site.NexusMods.Server/Migrations/BaseAppDbContextModelSnapshot.cs b/src/BUTR.Site.NexusMods.Server/Migrations/BaseAppDbContextModelSnapshot.cs index ac2f3670..372b72dc 100644 --- a/src/BUTR.Site.NexusMods.Server/Migrations/BaseAppDbContextModelSnapshot.cs +++ b/src/BUTR.Site.NexusMods.Server/Migrations/BaseAppDbContextModelSnapshot.cs @@ -19,7 +19,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "hstore"); @@ -108,11 +108,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("smallint") .HasColumnName("tenant"); - b.Property("Value") + b.Property("CrashReportFileId") .HasColumnType("text") .HasColumnName("crash_report_file_ignored_id"); - b.HasKey("TenantId", "Value"); + b.HasKey("TenantId", "CrashReportFileId"); b.ToTable("crash_report_file_ignored", "crashreport"); }); @@ -167,6 +167,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text") .HasColumnName("launcher_version"); + b.Property("OperatingSystemType") + .HasColumnType("text") + .HasColumnName("operating_system_type"); + + b.Property("OperatingSystemVersion") + .HasColumnType("text") + .HasColumnName("operating_system_version"); + b.Property("Runtime") .HasColumnType("text") .HasColumnName("runtime"); @@ -1466,6 +1474,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("BUTR.Site.NexusMods.Server.Models.Database.TenantEntity", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + b.Navigation("NexusModsUser"); });