Skip to content

Commit

Permalink
Task 07
Browse files Browse the repository at this point in the history
  • Loading branch information
OluwaninsolaAO committed Apr 22, 2023
1 parent cd20e11 commit c02c132
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions models/city.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@

class City(BaseModel, Base):
""" The city class, contains state ID and name """
__tablename__ = 'cities'
name = Column(String(128), nullable=False)
state_id = Column(String(60), ForeignKey('states.id'), nullable=False)
if os.environ.get('HBNB_TYPE_STORAGE') == 'db':
__tablename__ = 'cities'
name = Column(String(128), nullable=False)
state_id = Column(String(60), ForeignKey('states.id'),
nullable=False)

places = relationship('Place', cascade='all, delete', backref='cities')
places = relationship('Place', cascade='all, delete',
backref='cities')

else:
name = ""
state_id = ""

0 comments on commit c02c132

Please sign in to comment.