Split Pokédex version groups into their own table again.

spline-pokedex doesn't need to adapt; Pokedex.version_groups looks the
same as always and VersionGroup.pokedex wasn't used anywhere.
This commit is contained in:
Lynn "Zhorken" Vaughan 2013-11-06 08:51:28 -05:00
parent 386bbb1fdd
commit 66071291a6
3 changed files with 45 additions and 19 deletions

View file

@ -0,0 +1,16 @@
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
9,14
12,15
13,15
14,15
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
13 9 14
14 12 15
15 13 15
16 14 15

View file

@ -1,16 +1,16 @@
id,identifier,generation_id,pokedex_id,order
1,red-blue,1,2,1
2,yellow,1,2,2
3,gold-silver,2,3,3
4,crystal,2,3,4
5,ruby-sapphire,3,4,5
6,emerald,3,4,6
7,firered-leafgreen,3,2,9
8,diamond-pearl,4,5,10
9,platinum,4,6,11
10,heartgold-soulsilver,4,7,12
11,black-white,5,8,13
12,colosseum,3,,7
13,xd,3,,8
14,black-2-white-2,5,9,14
15,x-y,6,12,15
id,identifier,generation_id,order
1,red-blue,1,1
2,yellow,1,2
3,gold-silver,2,3
4,crystal,2,4
5,ruby-sapphire,3,5
6,emerald,3,6
7,firered-leafgreen,3,9
8,diamond-pearl,4,10
9,platinum,4,11
10,heartgold-soulsilver,4,12
11,black-white,5,13
12,colosseum,3,7
13,xd,3,8
14,black-2-white-2,5,14
15,x-y,6,15

1 id identifier generation_id pokedex_id order
2 1 red-blue 1 2 1
3 2 yellow 1 2 2
4 3 gold-silver 2 3 3
5 4 crystal 2 3 4
6 5 ruby-sapphire 3 4 5
7 6 emerald 3 4 6
8 7 firered-leafgreen 3 2 9
9 8 diamond-pearl 4 5 10
10 9 platinum 4 6 11
11 10 heartgold-soulsilver 4 7 12
12 11 black-white 5 8 13
13 12 colosseum 3 7
14 13 xd 3 8
15 14 black-2-white-2 5 9 14
16 15 x-y 6 12 15

View file

@ -1503,6 +1503,17 @@ create_translation_table('pokedex_prose', Pokedex, 'prose',
info=dict(description=u"A longer description of the Pokédex", format='plaintext')),
)
class PokedexVersionGroup(TableBase):
u"""A mapping from Pokédexes to version groups in which they appear as the
regional dex.
"""
__tablename__ = 'pokedex_version_groups'
__singlename__ = 'pokedex_version_group'
pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), primary_key=True,
info=dict(description=u'The ID of the Pokédex.'))
version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True,
info=dict(descruption=u'The ID of the version group.'))
class Pokemon(TableBase):
u"""A Pokémon. The core to this whole mess.
@ -2084,8 +2095,6 @@ class VersionGroup(TableBase):
info=dict(description=u"This version group's unique textual identifier."))
generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False,
info=dict(description=u"The ID of the generation the games in this group belong to."))
pokedex_id = Column(Integer, ForeignKey('pokedexes.id'), nullable=True,
info=dict(description=u"The ID of the regional Pokédex used in this version group. Null if not applicable."))
order = Column(Integer, nullable=True,
info=dict(description=u"Order for sorting. Almost by date of release, except similar versions are grouped together."))
@ -2496,9 +2505,10 @@ Pokedex.region = relationship(Region,
innerjoin=True,
backref='pokedexes')
Pokedex.version_groups = relationship(VersionGroup,
secondary=PokedexVersionGroup.__table__,
innerjoin=True,
order_by=VersionGroup.order.asc(),
backref='pokedex')
backref='pokedexes')
Pokemon.all_abilities = relationship(Ability,