Sugimori art for Gen V.
[zzz-pokedex.git] / pokedex / db / tables.py
index 846fb19..965cf6b 100644 (file)
@@ -672,6 +672,20 @@ class Move(TableBase):
     super_contest_effect_id = Column(Integer, ForeignKey('super_contest_effects.id'), nullable=True,
         info=dict(description="ID of the move's Super Contest effect"))
 
+class MoveChangelog(TableBase):
+    """History of changes to moves across main game versions."""
+    __tablename__ = 'move_changelog'
+    move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False,
+        info=dict(description="ID of the move that changed"))
+    changed_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False,
+        info=dict(description="ID of the version group in which the move changed"))
+    power = Column(SmallInteger, nullable=True,
+        info=dict(description="Prior base power of the move, or NULL if unchanged"))
+    pp = Column(SmallInteger, nullable=True,
+        info=dict(description="Prior base PP of the move, or NULL if unchanged"))
+    accuracy = Column(SmallInteger, nullable=True,
+        info=dict(description="Prior accuracy of the move, or NULL if unchanged"))
+
 class Nature(TableBase):
     u"""A nature a pokémon can have, such as Calm or Brave
     """
@@ -1031,6 +1045,20 @@ class PokemonFormGroup(TableBase):
     description = Column(markdown.MarkdownColumn(1024), nullable=False,
         info=dict(description=u"English description of how the forms work", format='markdown'))
 
+class PokemonFormPokeathlonStat(TableBase):
+    u"""A Pokémon form's performance in one Pokéathlon stat."""
+    __tablename__ = 'pokemon_form_pokeathlon_stats'
+    pokemon_form_id = Column(Integer, ForeignKey('pokemon_forms.id'), primary_key=True, nullable=False, autoincrement=False,
+        info=dict(description=u'The ID of the Pokémon form.'))
+    pokeathlon_stat_id = Column(Integer, ForeignKey('pokeathlon_stats.id'), primary_key=True, nullable=False, autoincrement=False,
+        info=dict(description=u'The ID of the Pokéathlon stat.'))
+    minimum_stat = Column(Integer, nullable=False, autoincrement=False,
+        info=dict(description=u'The minimum value for this stat for this Pokémon form.'))
+    base_stat = Column(Integer, nullable=False, autoincrement=False,
+        info=dict(description=u'The default value for this stat for this Pokémon form.'))
+    maximum_stat = Column(Integer, nullable=False, autoincrement=False,
+        info=dict(description=u'The maximum value for this stat for this Pokémon form.'))
+
 class PokemonHabitat(TableBase):
     u"""The habitat of a pokémon, as given in the FireRed/LeafGreen version pokédex
     """
@@ -1337,6 +1365,10 @@ LocationInternalID.generation = relation(Generation)
 Machine.item = relation(Item)
 Machine.version_group = relation(VersionGroup)
 
+Move.changelog = relation(MoveChangelog,
+    order_by=MoveChangelog.changed_in_version_group_id.asc(),
+    backref='move',
+)
 Move.contest_effect = relation(ContestEffect, backref='moves')
 Move.contest_combo_next = association_proxy('contest_combo_first', 'second')
 Move.contest_combo_prev = association_proxy('contest_combo_second', 'first')
@@ -1358,6 +1390,8 @@ Move.type = relation(Type, backref='moves')
 Move.effect = markdown.MoveEffectProperty('effect')
 Move.short_effect = markdown.MoveEffectProperty('short_effect')
 
+MoveChangelog.changed_in = relation(VersionGroup, backref='move_changelog')
+
 MoveEffect.category_map = relation(MoveEffectCategoryMap)
 MoveEffect.categories = association_proxy('category_map', 'category')
 MoveEffectCategoryMap.category = relation(MoveEffectCategory)
@@ -1481,10 +1515,15 @@ PokemonForm.unique_pokemon = relation(Pokemon, backref=backref('unique_form', us
                                       primaryjoin=PokemonForm.unique_pokemon_id==Pokemon.id)
 PokemonForm.version_group = relation(VersionGroup)
 PokemonForm.form_group = association_proxy('form_base_pokemon', 'form_group')
+PokemonForm.pokeathlon_stats = relation(PokemonFormPokeathlonStat,
+                                        order_by=PokemonFormPokeathlonStat.pokeathlon_stat_id,
+                                        backref='pokemon_form')
 
 PokemonFormGroup.pokemon = relation(Pokemon, backref=backref('form_group',
                                                              uselist=False))
 
+PokemonFormPokeathlonStat.pokeathlon_stat = relation(PokeathlonStat)
+
 PokemonItem.item = relation(Item, backref='pokemon')
 PokemonItem.version = relation(Version)