1
0
Fork 0
mirror of https://github.com/veekun/pokedex.git synced 2024-08-20 18:16:34 +00:00

Added ability flavour text.

We had D/P flavour text in the abilities table already, but I didn't
entirely trust it, so I reripped it along with the rest when I moved
flavour text into its own table.  And we didn't actually use the D/P
text anywhere, so I'm just going to pretend that it is entirely new.
This commit is contained in:
Zhorken 2010-05-04 02:03:01 -04:00
parent 641df3649d
commit 93108a6a84
2 changed files with 975 additions and 0 deletions
pokedex/db

View file

@ -20,6 +20,11 @@ class Ability(TableBase):
generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False)
effect = Column(rst.RstTextColumn(5120), nullable=False)
short_effect = Column(rst.RstTextColumn(255), nullable=False)
class AbilityFlavorText(TableBase):
__tablename__ = 'ability_flavor_text'
ability_id = Column(Integer, ForeignKey('abilities.id'), primary_key=True, nullable=False, autoincrement=False)
version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False)
flavor_text = Column(Unicode(64), nullable=False)
class Berry(TableBase):
@ -630,8 +635,11 @@ class Version(TableBase):
### Relations down here, to avoid ordering problems
Ability.flavor_text = relation(AbilityFlavorText, order_by=AbilityFlavorText.version_group_id, backref='abilities')
Ability.generation = relation(Generation, backref='abilities')
AbilityFlavorText.version_group = relation(VersionGroup)
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')