X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/6851a37c0e1cf6e9b03f60bc7b9c7314b037a1f6..20377587dc74c9d2580476706be7ea56749fe972:/pokedex/db/tables.py diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 9eb9dd9..a0a12a5 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -841,6 +841,8 @@ class Pokemon(TableBase): info=dict(description=u"Set iff the species' female front sprite is different from the male's in generation IV")) has_gen4_fem_back_sprite = Column(Boolean, nullable=False, info=dict(description=u"Set iff the species' female back sprite is different from the male's in generation IV")) + order = Column(Integer, nullable=False, index=True, + info=dict(description=u"Order for sorting. Almost national order, except families and forms are grouped together.")) ### Stuff to handle alternate Pokémon forms @@ -994,7 +996,9 @@ class PokemonEvolution(TableBase): relative_physical_stats = Column(Integer, nullable=True, info=dict(description=u"Relation of Attack and Defense stats the pokémon must have, as sgn(atk-def), or None if that doesn't matter")) party_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=True, - info=dict(description=u"ID of a pokémon that must be present in the party, or None if there's no such condition")) + info=dict(description=u"The ID of the Pokémon that must be present in the party.")) + trade_pokemon_id = Column(Integer, ForeignKey('pokemon.id'), nullable=True, + info=dict(description=u"The ID of the Pokémon for which this Pokémon must be traded.")) class PokemonFlavorText(TableBase): u"""In-game pokédex descrption of a pokémon. @@ -1368,6 +1372,7 @@ EncounterSlotCondition.condition = relation(EncounterCondition, EvolutionChain.growth_rate = relation(GrowthRate, backref='evolution_chains') EvolutionChain.baby_trigger_item = relation(Item, backref='evolution_chains') +EvolutionChain.pokemon = relation(Pokemon, order_by=Pokemon.order, back_populates='evolution_chain') Experience.growth_rate = relation(GrowthRate, backref='experience_table') @@ -1435,6 +1440,11 @@ Move.effect = markdown.MoveEffectProperty('effect') Move.short_effect = markdown.MoveEffectProperty('short_effect') MoveChangelog.changed_in = relation(VersionGroup, backref='move_changelog') +MoveChangelog.move_effect = relation(MoveEffect, backref='move_changelog') +MoveChangelog.type = relation(Type, backref='move_changelog') + +MoveChangelog.effect = markdown.MoveEffectProperty('effect') +MoveChangelog.short_effect = markdown.MoveEffectProperty('short_effect') MoveEffect.category_map = relation(MoveEffectCategoryMap) MoveEffect.categories = association_proxy('category_map', 'category') @@ -1494,8 +1504,8 @@ Pokemon.color = association_proxy('pokemon_color', 'name') Pokemon.dex_numbers = relation(PokemonDexNumber, order_by=PokemonDexNumber.pokedex_id.asc(), 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') + backref=backref('pokemon', order_by=Pokemon.order)) +Pokemon.evolution_chain = relation(EvolutionChain, back_populates='pokemon') Pokemon.child_pokemon = relation(Pokemon, primaryjoin=Pokemon.id==PokemonEvolution.from_pokemon_id, secondary=PokemonEvolution.__table__, @@ -1516,7 +1526,9 @@ Pokemon.items = relation(PokemonItem, backref='pokemon') Pokemon.generation = relation(Generation, backref='pokemon') Pokemon.shape = relation(PokemonShape, backref='pokemon') Pokemon.stats = relation(PokemonStat, backref='pokemon', order_by=PokemonStat.stat_id.asc()) -Pokemon.types = relation(Type, secondary=PokemonType.__table__, order_by=PokemonType.slot.asc(), backref='pokemon') +Pokemon.types = relation(Type, secondary=PokemonType.__table__, + order_by=PokemonType.slot.asc(), + back_populates='pokemon') PokemonDexNumber.pokedex = relation(Pokedex) @@ -1551,6 +1563,9 @@ PokemonEvolution.party_pokemon = relation(Pokemon, primaryjoin=PokemonEvolution.party_pokemon_id==Pokemon.id, backref='triggered_evolutions', ) +PokemonEvolution.trade_pokemon = relation(Pokemon, + primaryjoin=PokemonEvolution.trade_pokemon_id==Pokemon.id, +) PokemonFlavorText.version = relation(Version) @@ -1610,6 +1625,9 @@ Type.target_efficacies = relation(TypeEfficacy, Type.generation = relation(Generation, backref='types') Type.damage_class = relation(MoveDamageClass, backref='types') Type.foreign_names = relation(TypeName, backref='type') +Type.pokemon = relation(Pokemon, secondary=PokemonType.__table__, + order_by=Pokemon.order, + back_populates='types') TypeName.language = relation(Language)