From 3e6c6948aa5387b965d55dc48d58a425124bd2a0 Mon Sep 17 00:00:00 2001 From: Zhorken Date: Sun, 20 Dec 2009 01:41:40 -0500 Subject: [PATCH] Added types' generations and pre-gen-IV damage classes. --- pokedex/data/csv/types.csv | 38 +++++++++++++++++++------------------- pokedex/db/tables.py | 5 +++++ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/pokedex/data/csv/types.csv b/pokedex/data/csv/types.csv index 59ecb42..8f74b4a 100644 --- a/pokedex/data/csv/types.csv +++ b/pokedex/data/csv/types.csv @@ -1,19 +1,19 @@ -id,name,abbreviation -1,normal,NRM -2,fighting,FGT -3,flying,FLY -4,poison,PSN -5,ground,GRN -6,rock,RCK -7,bug,BUG -8,ghost,GST -9,steel,STL -10,fire,FIR -11,water,WTR -12,grass,GRS -13,electric,ELE -14,psychic,PSY -15,ice,ICE -16,dragon,DRG -17,dark,DAR -18,???,??? +id,name,abbreviation,generation_id,damage_class_id +1,normal,NRM,1,2 +2,fighting,FGT,1,2 +3,flying,FLY,1,2 +4,poison,PSN,1,2 +5,ground,GRN,1,2 +6,rock,RCK,1,2 +7,bug,BUG,1,2 +8,ghost,GST,1,2 +9,steel,STL,2,2 +10,fire,FIR,1,3 +11,water,WTR,1,3 +12,grass,GRS,1,3 +13,electric,ELE,1,3 +14,psychic,PSY,1,3 +15,ice,ICE,1,3 +16,dragon,DRG,1,3 +17,dark,DAR,2,3 +18,???,???,2,1 diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index afdbe10..2f43601 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -438,6 +438,8 @@ class Type(TableBase): id = Column(Integer, primary_key=True, nullable=False) name = Column(Unicode(8), nullable=False) abbreviation = Column(Unicode(3), nullable=False) + generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False) + damage_class_id = Column(Integer, ForeignKey('move_damage_classes.id'), nullable=False) ## ??? is none; everything else is physical or special class VersionGroup(TableBase): __tablename__ = 'version_groups' @@ -578,6 +580,9 @@ Type.target_efficacies = relation(TypeEfficacy, ==TypeEfficacy.target_type_id, backref='target_type') +Type.generation = relation(Generation, backref='types') +Type.damage_class = relation(MoveDamageClass, backref='types') + Version.version_group = relation(VersionGroup, backref='versions') Version.generation = association_proxy('version_group', 'generation') -- 2.7.4