X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/5c306b2f317f23c2b3a7dc5944a33bdd5fc38b80..745e4a66f4474acf4368fcc774e5100a6bcac39c:/pokedex/db/tables.py?ds=inline diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 3cde670..653f5af 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -20,6 +20,11 @@ class Ability(TableBase): flavor_text = Column(Unicode(64), nullable=False) effect = Column(Unicode(255), nullable=False) +class ContestCombo(TableBase): + __tablename__ = 'contest_combos' + first_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) + second_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) + class ContestEffect(TableBase): __tablename__ = 'contest_effects' id = Column(Integer, primary_key=True, nullable=False) @@ -171,9 +176,21 @@ class LocationAreaEncounterRate(TableBase): class Machine(TableBase): __tablename__ = 'machines' machine_number = Column(Integer, primary_key=True, nullable=False, autoincrement=False) - generation_id = Column(Integer, ForeignKey('generations.id'), primary_key=True, nullable=False, autoincrement=False) + version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False) move_id = Column(Integer, ForeignKey('moves.id'), nullable=False) +class MoveEffectCategory(TableBase): + __tablename__ = 'move_effect_categories' + id = Column(Integer, primary_key=True, nullable=False) + name = Column(Unicode(64), nullable=False) + can_affect_user = Column(Boolean, nullable=False) + +class MoveEffectCategoryMap(TableBase): + __tablename__ = 'move_effect_category_map' + move_effect_id = Column(Integer, ForeignKey('move_effects.id'), primary_key=True, nullable=False) + move_effect_category_id = Column(Integer, ForeignKey('move_effect_categories.id'), primary_key=True, nullable=False) + affects_user = Column(Boolean, primary_key=True, nullable=False) + class MoveDamageClass(TableBase): __tablename__ = 'move_damage_classes' id = Column(Integer, primary_key=True, nullable=False) @@ -332,6 +349,7 @@ class PokemonFormSprite(TableBase): __tablename__ = 'pokemon_form_sprites' id = Column(Integer, primary_key=True, nullable=False) pokemon_id = Column(Integer, ForeignKey('pokemon.id'), primary_key=True, nullable=False, autoincrement=False) + introduced_in_version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False) name = Column(Unicode(16), nullable=True) class PokemonItem(TableBase): @@ -386,6 +404,11 @@ class Stat(TableBase): id = Column(Integer, primary_key=True, nullable=False) name = Column(Unicode(16), nullable=False) +class SuperContestCombo(TableBase): + __tablename__ = 'super_contest_combos' + first_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) + second_move_id = Column(Integer, ForeignKey('moves.id'), primary_key=True, nullable=False, autoincrement=False) + class SuperContestEffect(TableBase): __tablename__ = 'super_contest_effects' id = Column(Integer, primary_key=True, nullable=False) @@ -418,6 +441,11 @@ class Version(TableBase): ### Relations down here, to avoid ordering problems +ContestCombo.first = relation(Move, primaryjoin=ContestCombo.first_move_id==Move.id, + backref='contest_combo_first') +ContestCombo.second = relation(Move, primaryjoin=ContestCombo.second_move_id==Move.id, + backref='contest_combo_second') + Encounter.pokemon = relation(Pokemon, backref='encounters') Encounter.version = relation(Version, backref='encounters') Encounter.location_area = relation(LocationArea, backref='encounters') @@ -435,9 +463,11 @@ Generation.versions = relation(Version, secondary=VersionGroup.__table__) LocationArea.location = relation(Location, backref='areas') -Machine.generation = relation(Generation) +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.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') @@ -447,6 +477,8 @@ Move.machines = relation(Machine, backref='move') Move.move_effect = relation(MoveEffect, backref='moves') Move.move_flags = relation(MoveFlag, backref='move') Move.super_contest_effect = relation(SuperContestEffect, backref='moves') +Move.super_contest_combo_next = association_proxy('super_contest_combo_first', 'second') +Move.super_contest_combo_prev = association_proxy('super_contest_combo_second', 'first') Move.target = relation(MoveTarget, backref='moves') Move.type = relation(Type, backref='moves') @@ -454,6 +486,10 @@ Move.effect = rst.MoveEffectProperty('effect') Move.priority = association_proxy('move_effect', 'priority') Move.short_effect = rst.MoveEffectProperty('short_effect') +MoveEffect.category_map = relation(MoveEffectCategoryMap) +MoveEffect.categories = association_proxy('category_map', 'category') +MoveEffectCategoryMap.category = relation(MoveEffectCategory) + MoveFlag.flag = relation(MoveFlagType) MoveFlavorText.generation = relation(Generation) @@ -493,6 +529,7 @@ PokemonItem.version = relation(Version) PokemonFormGroup.pokemon = relation(Pokemon, backref=backref('form_group', uselist=False)) PokemonFormSprite.pokemon = relation(Pokemon, backref='form_sprites') +PokemonFormSprite.introduced_in = relation(VersionGroup) PokemonMove.pokemon = relation(Pokemon, backref='pokemon_moves') PokemonMove.version_group = relation(VersionGroup) @@ -503,6 +540,11 @@ PokemonName.language = relation(Language) PokemonStat.stat = relation(Stat) +SuperContestCombo.first = relation(Move, primaryjoin=SuperContestCombo.first_move_id==Move.id, + backref='super_contest_combo_first') +SuperContestCombo.second = relation(Move, primaryjoin=SuperContestCombo.second_move_id==Move.id, + backref='super_contest_combo_second') + Type.damage_efficacies = relation(TypeEfficacy, primaryjoin=Type.id ==TypeEfficacy.damage_type_id,