+PokemonEvolution.from_pokemon = relation(Pokemon,
+ primaryjoin=PokemonEvolution.from_pokemon_id==Pokemon.id,
+ backref='child_evolutions',
+)
+PokemonEvolution.to_pokemon = relation(Pokemon,
+ primaryjoin=PokemonEvolution.to_pokemon_id==Pokemon.id,
+ backref=backref('parent_evolution', uselist=False),
+)
+PokemonEvolution.child_evolutions = relation(PokemonEvolution,
+ primaryjoin=PokemonEvolution.from_pokemon_id==PokemonEvolution.to_pokemon_id,
+ foreign_keys=[PokemonEvolution.to_pokemon_id],
+ backref=backref('parent_evolution',
+ remote_side=[PokemonEvolution.from_pokemon_id],
+ uselist=False,
+ ),
+)
+PokemonEvolution.trigger = relation(EvolutionTrigger, backref='evolutions')
+PokemonEvolution.trigger_item = relation(Item,
+ primaryjoin=PokemonEvolution.trigger_item_id==Item.id,
+ backref='triggered_evolutions',
+)
+PokemonEvolution.held_item = relation(Item,
+ primaryjoin=PokemonEvolution.held_item_id==Item.id,
+ backref='required_for_evolutions',
+)
+PokemonEvolution.location = relation(Location, backref='triggered_evolutions')
+PokemonEvolution.known_move = relation(Move, backref='triggered_evolutions')
+PokemonEvolution.party_pokemon = relation(Pokemon,
+ primaryjoin=PokemonEvolution.party_pokemon_id==Pokemon.id,
+ backref='triggered_evolutions',
+)
+