version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False)
flavor_text = Column(Unicode(64), nullable=False)
+class AbilityName(TableBase):
+ __tablename__ = 'ability_names'
+ ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False)
+ language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False)
+ name = Column(Unicode(16), nullable=False)
+
class Berry(TableBase):
__tablename__ = 'berries'
id = Column(Integer, primary_key=True, nullable=False)
steps_to_hatch = Column(Integer, nullable=False)
baby_trigger_item = Column(Unicode(12))
-class EvolutionMethod(TableBase):
- __tablename__ = 'evolution_methods'
- id = Column(Integer, primary_key=True, nullable=False)
- name = Column(Unicode(64), nullable=False)
- description = Column(Unicode(255), nullable=False)
-
class EvolutionTrigger(TableBase):
__tablename__ = 'evolution_triggers'
id = Column(Integer, primary_key=True, nullable=False)
### Relations down here, to avoid ordering problems
-Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='abilities')
+Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='ability')
+Ability.foreign_names = relation(AbilityName, backref='ability')
Ability.generation = relation(Generation, backref='abilities')
AbilityFlavorText.version_group = relation(VersionGroup)
+AbilityName.language = relation(Language)
+
Berry.berry_firmness = relation(BerryFirmness, backref='berries')
Berry.firmness = association_proxy('berry_firmness', 'name')
Berry.flavors = relation(BerryFlavor, order_by=BerryFlavor.contest_type_id, backref='berry')
Move.damage_class = relation(MoveDamageClass, backref='moves')
Move.flags = association_proxy('move_flags', 'flag')
Move.flavor_text = relation(MoveFlavorText, order_by=MoveFlavorText.version_group_id, backref='move')
-Move.foreign_names = relation(MoveName, backref='pokemon')
+Move.foreign_names = relation(MoveName, backref='move')
Move.generation = relation(Generation, backref='moves')
Move.machines = relation(Machine, backref='move')
Move.move_effect = relation(MoveEffect, backref='moves')
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,
- secondary=PokemonEvolution.__table__,
+Pokemon.child_pokemon = relation(Pokemon,
primaryjoin=Pokemon.id==PokemonEvolution.from_pokemon_id,
+ secondary=PokemonEvolution.__table__,
secondaryjoin=PokemonEvolution.to_pokemon_id==Pokemon.id,
- backref=backref('evolution_parent',
- remote_side=[Pokemon.id],
- uselist=False,
- ),
+ backref=backref('parent_pokemon', uselist=False),
)
Pokemon.flavor_text = relation(PokemonFlavorText, order_by=PokemonFlavorText.version_id.asc(), backref='pokemon')
Pokemon.foreign_names = relation(PokemonName, backref='pokemon')