-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added NexusModsModToModuleInfoHistoryEntity that will store the whole…
… ModuleInfo entry of NexusMods mods Will allow us to check for mod updates Also, batched savings for Artcle and File parsers
- Loading branch information
Showing
20 changed files
with
1,886 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...e.NexusMods.Server/Contexts/Configs/NexusModsModToModuleInfoHistoryEntityConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using BUTR.Site.NexusMods.Server.Models; | ||
using BUTR.Site.NexusMods.Server.Models.Database; | ||
|
||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace BUTR.Site.NexusMods.Server.Contexts.Configs; | ||
|
||
public class NexusModsModToModuleInfoHistoryEntityConfiguration : BaseEntityConfigurationWithTenant<NexusModsModToModuleInfoHistoryEntity> | ||
{ | ||
public NexusModsModToModuleInfoHistoryEntityConfiguration(ITenantContextAccessor tenantContextAccessor) : base(tenantContextAccessor) { } | ||
|
||
protected override void ConfigureModel(EntityTypeBuilder<NexusModsModToModuleInfoHistoryEntity> builder) | ||
{ | ||
builder.Property<NexusModsModId>(nameof(NexusModsModEntity.NexusModsModId)).HasColumnName("nexusmods_mod_name_id").HasConversion<NexusModsModId.EfCoreValueConverter>().ValueGeneratedNever(); | ||
builder.Property<ModuleId>(nameof(ModuleEntity.ModuleId)).HasColumnName("module_id").HasConversion<ModuleId.EfCoreValueConverter>(); | ||
builder.Property(x => x.ModuleVersion).HasColumnName("module_version").HasConversion<ModuleVersion.EfCoreValueConverter>(); | ||
builder.Property(x => x.ModuleInfo).HasColumnName("module_info").HasColumnType("jsonb"); | ||
builder.ToTable("nexusmods_mod_module_info_history", "nexusmods_mod").HasKey(nameof(NexusModsModToModuleInfoHistoryEntity.TenantId), nameof(NexusModsModEntity.NexusModsModId), nameof(ModuleEntity.ModuleId), nameof(NexusModsModToModuleInfoHistoryEntity.ModuleVersion)); | ||
|
||
builder.HasOne(x => x.NexusModsMod) | ||
.WithMany() | ||
.HasForeignKey(nameof(NexusModsModToModuleInfoHistoryEntity.TenantId), nameof(NexusModsModEntity.NexusModsModId)) | ||
.HasPrincipalKey(x => new { x.TenantId, x.NexusModsModId }) | ||
.OnDelete(DeleteBehavior.Cascade); | ||
|
||
builder.HasOne(x => x.Module) | ||
.WithMany() | ||
.HasForeignKey(nameof(NexusModsModToModuleInfoHistoryEntity.TenantId), nameof(ModuleEntity.ModuleId)) | ||
.HasPrincipalKey(x => new { x.TenantId, x.ModuleId }) | ||
.OnDelete(DeleteBehavior.Cascade); | ||
|
||
builder.Navigation(x => x.NexusModsMod).AutoInclude(); | ||
builder.Navigation(x => x.Module).AutoInclude(); | ||
|
||
base.ConfigureModel(builder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.