X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/639e513039ac1ae4389271f4f7a099233c0e064d..4fe178430584034cd4592d3e27ad9cd617830910:/pokedex/db/tables.py diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 4f5b80d..dc2b93c 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -217,6 +217,7 @@ class ItemFlingEffect(TableBase): class ItemPocket(TableBase): __tablename__ = 'item_pockets' id = Column(Integer, primary_key=True, nullable=False) + identifier = Column(Unicode(16), nullable=False) name = Column(Unicode(16), nullable=False) class Language(TableBase): @@ -321,7 +322,7 @@ class Move(TableBase): damage_class_id = Column(Integer, ForeignKey('move_damage_classes.id'), nullable=False) effect_id = Column(Integer, ForeignKey('move_effects.id'), nullable=False) effect_chance = Column(Integer) - contest_type = Column(Unicode(8), nullable=False) + contest_type_id = Column(Integer, ForeignKey('contest_types.id'), nullable=True) contest_effect_id = Column(Integer, ForeignKey('contest_effects.id'), nullable=True) super_contest_effect_id = Column(Integer, ForeignKey('super_contest_effects.id'), nullable=False) @@ -614,9 +615,13 @@ Generation.main_region = relation(Region) Item.berry = relation(Berry, uselist=False, backref='item') Item.fling_effect = relation(ItemFlingEffect, backref='items') -Item.category = relation(ItemCategory, backref='items') +Item.category = relation(ItemCategory) +Item.pocket = association_proxy('category', 'pocket') -ItemCategory.pocket = relation(ItemPocket, backref='categories') +ItemCategory.items = relation(Item, order_by=Item.name) +ItemCategory.pocket = relation(ItemPocket) + +ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.name) Location.region = relation(Region, backref='locations') @@ -627,6 +632,7 @@ Machine.version_group = relation(VersionGroup) 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') +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.generation_id, backref='move')