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:
@@ -7,19 +7,21 @@ from app.core.database import Base
|
||||
class Route(Base):
|
||||
__tablename__ = "routes"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("game_id", "name", name="uq_routes_game_name"),
|
||||
UniqueConstraint("version_group_id", "name", name="uq_routes_version_group_name"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(100))
|
||||
game_id: Mapped[int] = mapped_column(ForeignKey("games.id"), index=True)
|
||||
version_group_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("version_groups.id"), index=True
|
||||
)
|
||||
order: Mapped[int] = mapped_column(SmallInteger)
|
||||
parent_route_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("routes.id", ondelete="CASCADE"), index=True, default=None
|
||||
)
|
||||
pinwheel_zone: Mapped[int | None] = mapped_column(SmallInteger, default=None)
|
||||
|
||||
game: Mapped["Game"] = relationship(back_populates="routes")
|
||||
version_group: Mapped["VersionGroup"] = relationship(back_populates="routes")
|
||||
route_encounters: Mapped[list["RouteEncounter"]] = relationship(
|
||||
back_populates="route"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user