version_id = Column(Integer, ForeignKey('versions.id'), primary_key=True, autoincrement=False)
rate = Column(Integer, nullable=True)
+class LocationInternalID(TableBase):
+ __tablename__ = 'location_internal_ids'
+ location_id = Column(Integer, ForeignKey('locations.id'), nullable=False, primary_key=True)
+ generation_id = Column(Integer, ForeignKey('generations.id'), nullable=False, primary_key=True)
+ internal_id = Column(Integer, nullable=False)
+
class Machine(TableBase):
__tablename__ = 'machines'
machine_number = Column(Integer, primary_key=True, nullable=False, autoincrement=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 TypeName(TableBase):
+ __tablename__ = 'type_names'
+ type_id = Column(Integer, ForeignKey('types.id'), primary_key=True, nullable=False, autoincrement=False)
+ language_id = Column(Integer, ForeignKey('languages.id'), primary_key=True, nullable=False, autoincrement=False)
+ name = Column(Unicode(16), nullable=False)
+
class VersionGroup(TableBase):
__tablename__ = 'version_groups'
id = Column(Integer, primary_key=True, nullable=False)
ItemFlavorText.version_group = relation(VersionGroup)
+ItemInternalID.item = relation(Item, backref='internal_ids')
+ItemInternalID.generation = relation(Generation)
+
ItemName.language = relation(Language)
ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.name)
LocationArea.location = relation(Location, backref='areas')
+LocationInternalID.location = relation(Location, backref='internal_ids')
+LocationInternalID.generation = relation(Generation)
+
Machine.item = relation(Item)
Machine.version_group = relation(VersionGroup)
Type.generation = relation(Generation, backref='types')
Type.damage_class = relation(MoveDamageClass, backref='types')
+Type.foreign_names = relation(TypeName, backref='type')
+
+TypeName.language = relation(Language)
Version.version_group = relation(VersionGroup, backref='versions')
Version.generation = association_proxy('version_group', 'generation')