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:
21
backend/src/app/models/version_group.py
Normal file
21
backend/src/app/models/version_group.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class VersionGroup(Base):
|
||||
__tablename__ = "version_groups"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(100))
|
||||
slug: Mapped[str] = mapped_column(String(100), unique=True)
|
||||
|
||||
games: Mapped[list["Game"]] = relationship(back_populates="version_group")
|
||||
routes: Mapped[list["Route"]] = relationship(back_populates="version_group")
|
||||
boss_battles: Mapped[list["BossBattle"]] = relationship(
|
||||
back_populates="version_group"
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<VersionGroup(id={self.id}, name='{self.name}')>"
|
||||
Reference in New Issue
Block a user