Add version groups to share routes and boss battles across games

Routes and boss battles now belong to a version_group instead of
individual games, so paired versions (e.g. Red/Blue, Gold/Silver)
share the same route structure and boss battles. Route encounters
gain a game_id column to support game-specific encounter tables
within a shared route. Includes migration, updated seeds, API
changes, and frontend type updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 12:07:42 +01:00
parent 979f57f184
commit 3e88ba50fa
22 changed files with 631 additions and 161 deletions

View File

@@ -1,4 +1,4 @@
from sqlalchemy import SmallInteger, String
from sqlalchemy import ForeignKey, SmallInteger, String
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.core.database import Base
@@ -15,10 +15,14 @@ class Game(Base):
box_art_url: Mapped[str | None] = mapped_column(String(500))
release_year: Mapped[int | None] = mapped_column(SmallInteger)
color: Mapped[str | None] = mapped_column(String(7)) # Hex color e.g. #FF0000
version_group_id: Mapped[int | None] = mapped_column(
ForeignKey("version_groups.id"), index=True
)
routes: Mapped[list["Route"]] = relationship(back_populates="game")
version_group: Mapped["VersionGroup | None"] = relationship(
back_populates="games"
)
runs: Mapped[list["NuzlockeRun"]] = relationship(back_populates="game")
boss_battles: Mapped[list["BossBattle"]] = relationship(back_populates="game")
def __repr__(self) -> str:
return f"<Game(id={self.id}, name='{self.name}')>"