mirror of
https://github.com/claunia/marechai.git
synced 2026-07-08 17:57:08 +00:00
Compilations were previously modeled as a SoftwareRelease row with IsCompilation=true, with bundled contents tracked via release-keyed junction tables. This conflated "release" with "the thing being released" and blocked compilations from having their own identity, predecessor chain, or covers independent of any one release. Introduce SoftwareCompilation as a sibling entity to Software: - Has its own Name, optional bundling link to a Software or Machine (e.g. games bundled with an OS, or a dedicated handheld), and a predecessor/successor self-reference reusing SoftwareRelationshipType. - Owns its releases (SoftwareRelease.SoftwareCompilationId) and covers (SoftwareCover.SoftwareCompilationId), mirroring Software's existing patterns. - Owns its contained software/versions via new SoftwareBySoftwareCompilation / SoftwareVersionBySoftwareCompilation junctions (moved off SoftwareRelease, since different releases of the same compilation contain the same games). - Can itself be nested inside other compilations via SoftwareCompilationBySoftwareCompilation, a many-to-many junction (a sub-compilation can ship inside several different bundles). This also fixes a MobyGames importer bug where a compilation containing another compilation as one of its titles couldn't be resolved, because the original Software row backing the inner compilation was deleted with no replacement pointer recorded; MobyGamesImportState now gets a SoftwareCompilationId for exactly this case. Three migrations carry out the conversion: schema addition, a data backfill that converts existing IsCompilation=true releases into real SoftwareCompilation rows (re-pointing their releases, covers, and junction rows), and a cleanup migration dropping the old column/tables. Applied and verified against the dev database. Add SoftwareCompilationsController with CRUD, releases, covers, included-software/version junctions, and nested-compilation endpoints (with a cycle guard). Update SoftwareReleasesController, SoftwareController's catalog UNION queries, SearchController, and SoftwareReleaseSuggestionApplier to use SoftwareCompilationId instead of the removed IsCompilation flag. Remaining work (Marechai.ApiClient DTO mirrors, Blazor UI, Marechai.App compile fixes, MobyGames CompilationRelationService rewrite) is tracked separately and not yet included in this commit.
31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Marechai.Data;
|
|
|
|
namespace Marechai.Database.Models;
|
|
|
|
public class SoftwareCompilation : BaseModel<ulong>
|
|
{
|
|
[Required]
|
|
public string Name { get; set; }
|
|
|
|
public ulong? SoftwareId { get; set; }
|
|
public virtual Software Software { get; set; }
|
|
|
|
public int? MachineId { get; set; }
|
|
public virtual Machine Machine { get; set; }
|
|
|
|
public ulong? PredecessorId { get; set; }
|
|
public virtual SoftwareCompilation Predecessor { get; set; }
|
|
public SoftwareRelationshipType RelationshipType { get; set; } = SoftwareRelationshipType.Sequel;
|
|
public virtual ICollection<SoftwareCompilation> Successors { get; set; }
|
|
|
|
public virtual ICollection<SoftwareRelease> Releases { get; set; }
|
|
public virtual ICollection<SoftwareCover> Covers { get; set; }
|
|
|
|
public virtual ICollection<SoftwareBySoftwareCompilation> IncludedSoftware { get; set; }
|
|
public virtual ICollection<SoftwareVersionBySoftwareCompilation> IncludedVersions { get; set; }
|
|
public virtual ICollection<SoftwareCompilationBySoftwareCompilation> IncludedCompilations { get; set; }
|
|
public virtual ICollection<SoftwareCompilationBySoftwareCompilation> ContainingCompilations { get; set; }
|
|
}
|