You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Re: Issue #3 for data modeling, City model right now is simple:
class City(db.Model):
"""City where the restaurant is in."""
__tablename__ = "cities"
city_id = db.Column(db.Integer, autoincrement=True, primary_key=True)
city_name = db.Column(db.String(100), nullable=False)
updated_At = db.Column(db.DateTime, default=datetime.datetime.utcnow)
However, there could be two cities with the same name, but in different states or countries.
Per mentor, need to make it unique across 3 fields (city, state, country), so that there will not be a duplicated record in the table.
The text was updated successfully, but these errors were encountered:
itsahsiao
changed the title
City model - Additional fields so that 3 fields together make it unique
City model - Making a unique record based on city name, state, and country
May 11, 2016
itsahsiao
changed the title
City model - Making a unique record based on city name, state, and country
City model - Making a unique record based on city name, state, and country (3 fields combined)
May 11, 2016
Re: Issue #3 for data modeling, City model right now is simple:
However, there could be two cities with the same name, but in different states or countries.
Per mentor, need to make it unique across 3 fields (city, state, country), so that there will not be a duplicated record in the table.
Something to look into: http://stackoverflow.com/questions/10059345/sqlalchemy-unique-across-multiple-columns
The text was updated successfully, but these errors were encountered: