mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Require location identifiers to be unique.
Also require location area identifiers to be unique to their location. I almost added a duplicate pokemon-league location when adding S/M locations. This should help.
This commit is contained in:
parent
e6b64b8c5a
commit
59fd27c574
1 changed files with 6 additions and 1 deletions
|
@ -1103,7 +1103,7 @@ class Location(TableBase):
|
|||
doc=u"A numeric ID")
|
||||
region_id = Column(Integer, ForeignKey('regions.id'),
|
||||
doc=u"ID of the region this location is in")
|
||||
identifier = Column(Unicode(79), nullable=False,
|
||||
identifier = Column(Unicode(79), nullable=False, unique=True,
|
||||
doc=u"An identifier",
|
||||
info=dict(format='identifier'))
|
||||
|
||||
|
@ -1133,6 +1133,11 @@ class LocationArea(TableBase):
|
|||
doc=u"An identifier",
|
||||
info=dict(format='identifier'))
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint(location_id, identifier),
|
||||
{},
|
||||
)
|
||||
|
||||
create_translation_table('location_area_prose', LocationArea, 'prose',
|
||||
relation_lazy='joined',
|
||||
name = Column(Unicode(79), nullable=True, index=True,
|
||||
|
|
Loading…
Reference in a new issue