Added natures table.
authorEevee <git@veekun.com>
Tue, 23 Mar 2010 05:29:28 +0000 (22:29 -0700)
committerEevee <git@veekun.com>
Mon, 29 Mar 2010 05:18:24 +0000 (22:18 -0700)
pokedex/data/csv/natures.csv [new file with mode: 0644]
pokedex/db/tables.py

diff --git a/pokedex/data/csv/natures.csv b/pokedex/data/csv/natures.csv
new file mode 100644 (file)
index 0000000..0e6a464
--- /dev/null
@@ -0,0 +1,26 @@
+id,name,decreased_stat_id,increased_stat_id
+1,Hardy,2,2
+2,Bold,2,3
+3,Modest,2,4
+4,Calm,2,5
+5,Timid,2,6
+6,Lonely,3,2
+7,Docile,3,3
+8,Mild,3,4
+9,Gentle,3,5
+10,Hasty,3,6
+11,Adamant,4,2
+12,Impish,4,3
+13,Bashful,4,4
+14,Careful,4,5
+15,Rash,4,5
+16,Jolly,4,6
+17,Naughty,5,2
+18,Lax,5,3
+19,Quirky,5,5
+20,Naive,5,6
+21,Brave,6,2
+22,Relaxed,6,3
+23,Quiet,6,4
+24,Sassy,6,5
+25,Serious,6,6
index a123231..01a070d 100644 (file)
@@ -265,6 +265,13 @@ class Move(TableBase):
     contest_effect_id = Column(Integer, ForeignKey('contest_effects.id'), nullable=True)
     super_contest_effect_id = Column(Integer, ForeignKey('super_contest_effects.id'), nullable=False)
 
+class Nature(TableBase):
+    __tablename__ = 'natures'
+    id = Column(Integer, primary_key=True, nullable=False)
+    name = Column(Unicode(8), nullable=False)
+    decreased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False)
+    increased_stat_id = Column(Integer, ForeignKey('stats.id'), nullable=False)
+
 class Pokedex(TableBase):
     __tablename__ = 'pokedexes'
     id = Column(Integer, primary_key=True, nullable=False)
@@ -556,6 +563,11 @@ MoveFlavorText.generation = relation(Generation)
 
 MoveName.language = relation(Language)
 
+Nature.decreased_stat = relation(Stat, primaryjoin=Nature.decreased_stat_id==Stat.id,
+                                       backref='decreasing_natures')
+Nature.increased_stat = relation(Stat, primaryjoin=Nature.increased_stat_id==Stat.id,
+                                       backref='increasing_natures')
+
 Pokedex.version_groups = relation(VersionGroup, secondary=PokedexVersionGroup.__table__)
 
 Pokemon.abilities = relation(Ability, secondary=PokemonAbility.__table__,