Files
marechai/Marechai.Database/Models/SoftwareCompilationBySoftwareCompilation.cs
Natalia Portillo e399e14d38 feat: Make software compilations an independent entity
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.
2026-06-26 03:51:51 +01:00

11 lines
386 B
C#

namespace Marechai.Database.Models;
public class SoftwareCompilationBySoftwareCompilation
{
public ulong ParentCompilationId { get; set; }
public virtual SoftwareCompilation ParentCompilation { get; set; }
public ulong ChildCompilationId { get; set; }
public virtual SoftwareCompilation ChildCompilation { get; set; }
}