Update the form group description column. #210
[zzz-pokedex.git] / pokedex / db / tables.py
index 82159d3..8bd9c90 100644 (file)
@@ -28,6 +28,12 @@ class AbilityFlavorText(TableBase):
     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)
@@ -174,12 +180,6 @@ class EvolutionChain(TableBase):
     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)
@@ -543,7 +543,7 @@ class PokemonFormGroup(TableBase):
     __tablename__ = 'pokemon_form_groups'
     pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False)
     is_battle_only = Column(Boolean, nullable=False)
-    description = Column(Unicode(512), nullable=False)
+    description = Column(rst.RstTextColumn(1024), nullable=False)
 
 class PokemonFormSprite(TableBase):
     __tablename__ = 'pokemon_form_sprites'
@@ -660,11 +660,14 @@ class Version(TableBase):
 
 
 ### 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')
@@ -736,7 +739,7 @@ Move.contest_type = relation(ContestType, backref='moves')
 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')
@@ -800,15 +803,11 @@ 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,
-    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')