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:
@@ -8,7 +8,9 @@ class BossBattle(Base):
|
||||
__tablename__ = "boss_battles"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
game_id: Mapped[int] = mapped_column(ForeignKey("games.id"), index=True)
|
||||
version_group_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("version_groups.id"), index=True
|
||||
)
|
||||
name: Mapped[str] = mapped_column(String(100))
|
||||
boss_type: Mapped[str] = mapped_column(String(20)) # gym_leader, elite_four, champion, rival, evil_team, other
|
||||
badge_name: Mapped[str | None] = mapped_column(String(100))
|
||||
@@ -21,7 +23,9 @@ class BossBattle(Base):
|
||||
location: Mapped[str] = mapped_column(String(200))
|
||||
sprite_url: Mapped[str | None] = mapped_column(String(500))
|
||||
|
||||
game: Mapped["Game"] = relationship(back_populates="boss_battles")
|
||||
version_group: Mapped["VersionGroup"] = relationship(
|
||||
back_populates="boss_battles"
|
||||
)
|
||||
after_route: Mapped["Route | None"] = relationship()
|
||||
pokemon: Mapped[list["BossPokemon"]] = relationship(
|
||||
back_populates="boss_battle", cascade="all, delete-orphan"
|
||||
|
||||
Reference in New Issue
Block a user