X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/56d77dd66179f484e0a7d3a6614a155c14f36e65..32fe4eedee350ddca0c66f2404967cc73f89d957:/pokedex/db/tables.py?ds=inline diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 7b749cc..e6a7b77 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -254,6 +254,12 @@ class ItemInternalID(TableBase): generation_id = Column(Integer, ForeignKey('generations.id'), primary_key=True, autoincrement=False, nullable=False) internal_id = Column(Integer, nullable=False) +class ItemName(TableBase): + __tablename__ = 'item_names' + item_id = Column(Integer, ForeignKey('items.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 ItemPocket(TableBase): __tablename__ = 'item_pockets' id = Column(Integer, primary_key=True, nullable=False) @@ -393,6 +399,12 @@ class NatureBattleStylePreference(TableBase): low_hp_preference = Column(Integer, nullable=False) high_hp_preference = Column(Integer, nullable=False) +class NatureName(TableBase): + __tablename__ = 'nature_names' + nature_id = Column(Integer, ForeignKey('natures.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(8), nullable=False) + class NaturePokeathlonStat(TableBase): __tablename__ = 'nature_pokeathlon_stats' nature_id = Column(Integer, ForeignKey('natures.id'), primary_key=True, nullable=False) @@ -741,6 +753,7 @@ Item.berry = relation(Berry, uselist=False, backref='item') Item.flags = relation(ItemFlag, secondary=ItemFlagMap.__table__) Item.flavor_text = relation(ItemFlavorText, order_by=ItemFlavorText.version_group_id.asc(), backref='item') Item.fling_effect = relation(ItemFlingEffect, backref='items') +Item.foreign_names = relation(ItemName, backref='item') Item.machines = relation(Machine, order_by=Machine.version_group_id.asc()) Item.category = relation(ItemCategory) Item.pocket = association_proxy('category', 'pocket') @@ -750,6 +763,8 @@ ItemCategory.pocket = relation(ItemPocket) ItemFlavorText.version_group = relation(VersionGroup) +ItemName.language = relation(Language) + ItemPocket.categories = relation(ItemCategory, order_by=ItemCategory.name) Location.region = relation(Region, backref='locations') @@ -791,6 +806,7 @@ MoveFlavorText.version_group = relation(VersionGroup) MoveName.language = relation(Language) +Nature.foreign_names = relation(NatureName, backref='nature') 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, @@ -806,6 +822,8 @@ Nature.pokeathlon_effects = relation(NaturePokeathlonStat, order_by=NaturePokeat NatureBattleStylePreference.battle_style = relation(MoveBattleStyle, backref='nature_preferences') +NatureName.language = relation(Language) + NaturePokeathlonStat.pokeathlon_stat = relation(PokeathlonStat, backref='nature_effects') Pokedex.region = relation(Region, backref='pokedexes') @@ -819,7 +837,7 @@ Pokemon.formes = relation(Pokemon, primaryjoin=Pokemon.id==Pokemon.forme_base_po remote_side=[Pokemon.id])) Pokemon.pokemon_color = relation(PokemonColor, backref='pokemon') Pokemon.color = association_proxy('pokemon_color', 'name') -Pokemon.dex_numbers = relation(PokemonDexNumber, backref='pokemon') +Pokemon.dex_numbers = relation(PokemonDexNumber, order_by=PokemonDexNumber.pokedex_id.asc(), backref='pokemon') Pokemon.default_form_sprite = relation(PokemonFormSprite, primaryjoin=and_( Pokemon.id==PokemonFormSprite.pokemon_id,