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.
51 lines
2.8 KiB
C#
51 lines
2.8 KiB
C#
/******************************************************************************
|
|
// MARECHAI: Master repository of computing history artifacts information
|
|
// ----------------------------------------------------------------------------
|
|
//
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
//
|
|
// --[ License ] --------------------------------------------------------------
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
// License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
// ----------------------------------------------------------------------------
|
|
// Copyright © 2003-2026 Natalia Portillo
|
|
*******************************************************************************/
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Marechai.Database.Models;
|
|
|
|
public class SoftwareVersion : BaseModel<ulong>
|
|
{
|
|
[Required]
|
|
public ulong SoftwareId { get; set; }
|
|
public virtual Software Software { get; set; }
|
|
public string Codename { get; set; }
|
|
[Required]
|
|
public string VersionString { get; set; } // e.g. "4.00.950"
|
|
public string PublicVersion { get; set; } // e.g. "Windows 95"
|
|
public ulong? ParentVersionId { get; set; }
|
|
public int? LicenseId { get; set; }
|
|
public virtual SoftwareVersion ParentVersion { get; set; }
|
|
public virtual License License { get; set; }
|
|
public virtual ICollection<SoftwareVersion> Children { get; set; }
|
|
public virtual ICollection<SoftwareRequirement> Requirements { get; set; }
|
|
public virtual ICollection<SoftwareOSCompatibility> OSCompatibility { get; set; }
|
|
public virtual ICollection<SoftwareRelease> Releases { get; set; }
|
|
public virtual ICollection<CompanyBySoftwareVersion> Companies { get; set; }
|
|
public virtual ICollection<SoftwareScreenshot> Screenshots { get; set; }
|
|
public virtual ICollection<SoftwareVersionBySoftwareCompilation> CompilationMemberships { get; set; }
|
|
} |