You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of right now, .exo schemas don't allow to have more than one "one to many" relations towards the same Type.
e.g.
type Game {
@pk id: Int = autoIncrement()
player1: Player
player2: Player
}
type Player {
@pk id: Int = autoIncrement()
name: String
games: Set<Game>
}
In the example described above, there is no distinction between player1 or player2 games as they are completely coupled to each other, however, they reference different rows and make sense for this specific domain.
Possible workaround
One potential workaround is to model the relationship as a many-to-many relation, accepting that each Game will always have exactly 2 players (player1 and player2). This could look something like:
type Game {
@pk id: Int = autoIncrement()
playerGames: Set<PlayerGame>
}
type PlayerGame {
@pk id: Int = autoIncrement()
player: Player
game: Game
}
type Player {
@pk id: Int = autoIncrement()
name: String
playerGames: Set<PlayerGame>
}
While this approach works, it imposes additional complexity and doesn’t fully capture the semantics of having two distinct Player roles in the Game type.
The text was updated successfully, but these errors were encountered:
Description
As of right now,
.exo
schemas don't allow to have more than one "one to many" relations towards the sameType
.e.g.
In the example described above, there is no distinction between
player1
orplayer2
games as they are completely coupled to each other, however, they reference different rows and make sense for this specific domain.Possible workaround
One potential workaround is to model the relationship as a many-to-many relation, accepting that each Game will always have exactly 2 players (player1 and player2). This could look something like:
While this approach works, it imposes additional complexity and doesn’t fully capture the semantics of having two distinct Player roles in the Game type.
The text was updated successfully, but these errors were encountered: