+
+
+### Relations down here, to avoid ordering problems
+EvolutionChain.growth_rate = relation(GrowthRate, backref='evolution_chains')
+Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__,
+ order_by=PokemonAbility.slot,
+ backref='pokemon')
+Pokemon.dex_numbers = relation(PokemonDexNumber, backref='pokemon')
+Pokemon.egg_groups = relation(EggGroup, secondary=PokemonEggGroup.__table__,
+ order_by=PokemonEggGroup.egg_group_id,
+ backref='pokemon')
+Pokemon.evolution_chain = relation(EvolutionChain, backref='pokemon')
+Pokemon.evolution_method = relation(EvolutionMethod)
+Pokemon.evolution_children = relation(Pokemon, primaryjoin=Pokemon.id==Pokemon.evolution_parent_pokemon_id,
+ backref=backref('evolution_parent',
+ remote_side=[Pokemon.id]))
+Pokemon.flavor_text = relation(PokemonFlavorText, backref='pokemon')
+Pokemon.foreign_names = relation(PokemonName, backref='pokemon')
+Pokemon.generation = relation(Generation, backref='pokemon')
+Pokemon.shape = relation(PokemonShape, backref='pokemon')
+Pokemon.stats = relation(PokemonStat, backref='pokemon')
+Pokemon.types = relation(Type, secondary=PokemonType.__table__)
+
+PokemonDexNumber.generation = relation(Generation)
+
+PokemonFlavorText.version = relation(Version)
+
+PokemonName.language = relation(Language)
+
+PokemonStat.stat = relation(Stat)
+
+Type.damage_efficacies = relation(TypeEfficacy,
+ primaryjoin=Type.id
+ ==TypeEfficacy.damage_type_id,
+ backref='damage_type')
+Type.target_efficacies = relation(TypeEfficacy,
+ primaryjoin=Type.id
+ ==TypeEfficacy.target_type_id,
+ backref='target_type')