mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Replace a couple of double relationships with a single one with backref
This commit is contained in:
parent
2d545de5bf
commit
62c8ca421a
1 changed files with 8 additions and 12 deletions
|
@ -2475,7 +2475,8 @@ Experience.growth_rate = relationship(GrowthRate,
|
||||||
Generation.versions = relationship(Version,
|
Generation.versions = relationship(Version,
|
||||||
secondary=VersionGroup.__table__,
|
secondary=VersionGroup.__table__,
|
||||||
innerjoin=True)
|
innerjoin=True)
|
||||||
Generation.main_region = relationship(Region, innerjoin=True)
|
Generation.main_region = relationship(Region, innerjoin=True,
|
||||||
|
backref=backref('generation', uselist=False))
|
||||||
|
|
||||||
|
|
||||||
GrowthRate.max_experience_obj = relationship(Experience,
|
GrowthRate.max_experience_obj = relationship(Experience,
|
||||||
|
@ -2497,14 +2498,13 @@ Item.flavor_text = relationship(ItemFlavorText,
|
||||||
Item.fling_effect = relationship(ItemFlingEffect,
|
Item.fling_effect = relationship(ItemFlingEffect,
|
||||||
backref='items')
|
backref='items')
|
||||||
Item.machines = relationship(Machine,
|
Item.machines = relationship(Machine,
|
||||||
order_by=Machine.version_group_id.asc())
|
order_by=Machine.version_group_id.asc(),
|
||||||
|
backref='item')
|
||||||
Item.category = relationship(ItemCategory,
|
Item.category = relationship(ItemCategory,
|
||||||
innerjoin=True,
|
innerjoin=True,
|
||||||
backref=backref('items', order_by=Item.identifier.asc()))
|
backref=backref('items', order_by=Item.identifier.asc()))
|
||||||
Item.pocket = association_proxy('category', 'pocket')
|
Item.pocket = association_proxy('category', 'pocket')
|
||||||
|
|
||||||
ItemCategory.pocket = relationship(ItemPocket, innerjoin=True)
|
|
||||||
|
|
||||||
ItemFlavorText.version_group = relationship(VersionGroup,
|
ItemFlavorText.version_group = relationship(VersionGroup,
|
||||||
innerjoin=True, lazy='joined')
|
innerjoin=True, lazy='joined')
|
||||||
ItemFlavorText.language = relationship(Language,
|
ItemFlavorText.language = relationship(Language,
|
||||||
|
@ -2518,7 +2518,8 @@ ItemGameIndex.generation = relationship(Generation,
|
||||||
|
|
||||||
ItemPocket.categories = relationship(ItemCategory,
|
ItemPocket.categories = relationship(ItemCategory,
|
||||||
innerjoin=True,
|
innerjoin=True,
|
||||||
order_by=ItemCategory.identifier.asc())
|
order_by=ItemCategory.identifier.asc(),
|
||||||
|
backref=backref('pocket', innerjoin=True))
|
||||||
|
|
||||||
|
|
||||||
Location.region = relationship(Region,
|
Location.region = relationship(Region,
|
||||||
|
@ -2542,11 +2543,6 @@ LocationGameIndex.generation = relationship(Generation,
|
||||||
innerjoin=True, lazy='joined')
|
innerjoin=True, lazy='joined')
|
||||||
|
|
||||||
|
|
||||||
Machine.item = relationship(Item)
|
|
||||||
Machine.version_group = relationship(VersionGroup,
|
|
||||||
innerjoin=True, lazy='joined')
|
|
||||||
|
|
||||||
|
|
||||||
Move.changelog = relationship(MoveChangelog,
|
Move.changelog = relationship(MoveChangelog,
|
||||||
order_by=MoveChangelog.changed_in_version_group_id.desc(),
|
order_by=MoveChangelog.changed_in_version_group_id.desc(),
|
||||||
backref=backref('move', innerjoin=True, lazy='joined'))
|
backref=backref('move', innerjoin=True, lazy='joined'))
|
||||||
|
@ -2886,7 +2882,6 @@ PokemonSpecies.conquest_evolution = relationship(ConquestPokemonEvolution,
|
||||||
PokemonSpeciesFlavorText.version = relationship(Version, innerjoin=True, lazy='joined')
|
PokemonSpeciesFlavorText.version = relationship(Version, innerjoin=True, lazy='joined')
|
||||||
PokemonSpeciesFlavorText.language = relationship(Language, innerjoin=True, lazy='joined')
|
PokemonSpeciesFlavorText.language = relationship(Language, innerjoin=True, lazy='joined')
|
||||||
|
|
||||||
Region.generation = relationship(Generation, uselist=False)
|
|
||||||
Region.version_group_regions = relationship(VersionGroupRegion,
|
Region.version_group_regions = relationship(VersionGroupRegion,
|
||||||
order_by=VersionGroupRegion.version_group_id.asc(),
|
order_by=VersionGroupRegion.version_group_id.asc(),
|
||||||
backref='region')
|
backref='region')
|
||||||
|
@ -2950,7 +2945,8 @@ VersionGroup.pokemon_move_methods = relationship(PokemonMoveMethod,
|
||||||
backref="version_groups")
|
backref="version_groups")
|
||||||
VersionGroup.machines = relationship(Machine,
|
VersionGroup.machines = relationship(Machine,
|
||||||
innerjoin=True,
|
innerjoin=True,
|
||||||
order_by=Machine.machine_number)
|
order_by=Machine.machine_number,
|
||||||
|
backref=backref('version_group', innerjoin=True, lazy='joined'))
|
||||||
|
|
||||||
|
|
||||||
VersionGroupPokemonMoveMethod.version_group = relationship(VersionGroup,
|
VersionGroupPokemonMoveMethod.version_group = relationship(VersionGroup,
|
||||||
|
|
Loading…
Reference in a new issue