Add and tweak more relationships.

This commit is contained in:
Lynn "Zhorken" Vaughan 2012-07-31 23:43:24 -04:00
parent 47410a9e9c
commit 3c76c08042
2 changed files with 12 additions and 4 deletions

View file

@ -1,4 +1,4 @@
warrior_rank_id,warrior_stat_id,stat warrior_rank_id,warrior_stat_id,base_stat
1,1,65 1,1,65
1,2,60 1,2,60
1,3,65 1,3,65

1 warrior_rank_id warrior_stat_id stat base_stat
2 1 1 65
3 1 2 60
4 1 3 65

View file

@ -398,7 +398,7 @@ class ConquestWarriorRankStatMap(TableBase):
info=dict(description=u'The ID of the warrior rank.')) info=dict(description=u'The ID of the warrior rank.'))
warrior_stat_id = Column(Integer, ForeignKey('conquest_warrior_stats.id'), primary_key=True, autoincrement=False, warrior_stat_id = Column(Integer, ForeignKey('conquest_warrior_stats.id'), primary_key=True, autoincrement=False,
info=dict(description=u'The ID of the warrior stat.')) info=dict(description=u'The ID of the warrior stat.'))
stat = Column(Integer, nullable=False, base_stat = Column(Integer, nullable=False,
info=dict(description=u'The stat.')) info=dict(description=u'The stat.'))
class ConquestWarriorSkill(TableBase): class ConquestWarriorSkill(TableBase):
@ -1958,7 +1958,7 @@ ConquestMaxLink.pokemon = relationship(PokemonSpecies,
ConquestMaxLink.warrior_rank = relationship(ConquestWarriorRank, ConquestMaxLink.warrior_rank = relationship(ConquestWarriorRank,
uselist=False, uselist=False,
innerjoin=True, lazy='joined', innerjoin=True, lazy='joined',
backref='max_links') backref=backref('max_links', lazy='dynamic'))
ConquestMaxLink.warrior = association_proxy('warrior_rank', 'warrior') ConquestMaxLink.warrior = association_proxy('warrior_rank', 'warrior')
ConquestPokemonEvolution.gender = relationship(Gender, ConquestPokemonEvolution.gender = relationship(Gender,
@ -1977,6 +1977,9 @@ ConquestPokemonStat.stat = relationship(ConquestStat,
uselist=False, uselist=False,
backref='pokemon_stats') backref='pokemon_stats')
ConquestWarrior.archetype = relationship(ConquestWarriorArchetype,
uselist=False,
backref=backref('warriors'))
ConquestWarrior.ranks = relationship(ConquestWarriorRank, ConquestWarrior.ranks = relationship(ConquestWarriorRank,
order_by=ConquestWarriorRank.rank, order_by=ConquestWarriorRank.rank,
innerjoin=True, lazy='joined', innerjoin=True, lazy='joined',
@ -1990,12 +1993,17 @@ ConquestWarrior.types = relationship(Type,
ConquestWarriorRank.skill = relationship(ConquestWarriorSkill, ConquestWarriorRank.skill = relationship(ConquestWarriorSkill,
uselist=False, uselist=False,
innerjoin=True, lazy='joined', innerjoin=True, lazy='joined',
backref='warrior_ranks') backref=backref('warrior_ranks', order_by=ConquestWarriorRank.id))
ConquestWarriorRank.stats = relationship(ConquestWarriorRankStatMap, ConquestWarriorRank.stats = relationship(ConquestWarriorRankStatMap,
innerjoin=True, lazy='joined', innerjoin=True, lazy='joined',
order_by = ConquestWarriorRankStatMap.warrior_stat_id, order_by = ConquestWarriorRankStatMap.warrior_stat_id,
backref=backref('warrior_rank', uselist=False, innerjoin=True)) backref=backref('warrior_rank', uselist=False, innerjoin=True))
ConquestWarriorRankStatMap.stat = relationship(ConquestWarriorStat,
innerjoin=True, lazy='joined',
uselist=False,
backref='stat_map')
ContestCombo.first = relationship(Move, ContestCombo.first = relationship(Move,
primaryjoin=ContestCombo.first_move_id==Move.id, primaryjoin=ContestCombo.first_move_id==Move.id,