Version group Pokédexes don't need their own table.

This commit is contained in:
Zhorken 2010-12-04 20:46:06 -05:00
parent 40d94a3ed0
commit 523552e2d6
3 changed files with 16 additions and 34 deletions

View file

@ -1,12 +0,0 @@
pokedex_id,version_group_id
2,1
2,2
2,7
3,3
3,4
4,5
4,6
5,8
6,9
7,10
8,11
1 pokedex_id version_group_id
2 2 1
3 2 2
4 2 7
5 3 3
6 3 4
7 4 5
8 4 6
9 5 8
10 6 9
11 7 10
12 8 11

View file

@ -1,12 +1,12 @@
id,generation_id
1,1
2,1
3,2
4,2
5,3
6,3
7,3
8,4
9,4
10,4
11,5
id,generation_id,pokedex_id
1,1,2
2,1,2
3,2,3
4,2,3
5,3,4
6,3,4
7,3,2
8,4,5
9,4,6
10,4,7
11,5,8

1 id generation_id pokedex_id
2 1 1 2
3 2 1 2
4 3 2 3
5 4 2 3
6 5 3 4
7 6 3 4
8 7 3 2
9 8 4 5
10 9 4 6
11 10 4 7
12 11 5 8

View file

@ -771,15 +771,6 @@ class Pokedex(TableBase):
description = Column(Unicode(512),
info=dict(description=u"A longer description of the pokédex", format='plaintext'))
class PokedexVersionGroup(TableBase):
u"""Maps a pokédex to the version group that uses it
"""
__tablename__ = 'pokedex_version_groups'
pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description=u"ID of the pokédex"))
version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True, nullable=False, autoincrement=False,
info=dict(description=u"ID of the version group"))
class Pokemon(TableBase):
u"""A species of Pokémon. The core to this whole mess.
"""
@ -1257,6 +1248,8 @@ class VersionGroup(TableBase):
info=dict(description=u"A numeric ID"))
generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False,
info=dict(description=u"ID of the generation the games of this group belong to"))
pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), nullable=False,
info=dict(description=u"ID of the regional Pokédex used in this version group."))
class VersionGroupRegion(TableBase):
u"""Maps a region to a game version group that features it
@ -1423,7 +1416,7 @@ NatureName.language = relation(Language)
NaturePokeathlonStat.pokeathlon_stat = relation(PokeathlonStat, backref='nature_effects')
Pokedex.region = relation(Region, backref='pokedexes')
Pokedex.version_groups = relation(VersionGroup, secondary=PokedexVersionGroup.__table__, backref='pokedexes')
Pokedex.version_groups = relation(VersionGroup, order_by=VersionGroup.id, back_populates='pokedex')
Pokemon.all_abilities = relation(Ability,
secondary=PokemonAbility.__table__,
@ -1575,3 +1568,4 @@ Version.generation = association_proxy('version_group', 'generation')
VersionGroup.generation = relation(Generation, backref='version_groups')
VersionGroup.version_group_regions = relation(VersionGroupRegion, backref='version_group')
VersionGroup.regions = association_proxy('version_group_regions', 'region')
VersionGroup.pokedex = relation(Pokedex, back_populates='version_groups')