class City(db.Model): __tablename__ = 'Cities' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(120)) state = db.Column(db.String(2)) artists = db.relationship('Artist', back_populates='city', lazy='joined') venues = db.relationship('Venue', back_populates='city', lazy='joined')
class Actor(db.Model): __tablename__ = "actors" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) birthday = db.Column(db.Date, nullable=False) sex = db.Column(db.Boolean, nullable=False) profile_url = db.Column(db.String(300)) photo_url = db.Column(db.String(300))
class Movie(db.Model): __tablename__ = "movies" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) description = db.Column(db.String(300)) release_date = db.Column(db.Date) release_country = db.Column(db.String(50)) genres = db.relationship("Genre", secondary=movie_genre_table, back_populates="movies", lazy="joined") languages = db.relationship("Language", secondary=movie_language_table, back_populates="movies", lazy="joined")
class Language(db.Model): __tablename__ = "languages" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), nullable=False) movies = db.relationship("Movie", secondary=movie_language_table, back_populates="languages")
class Artist(db.Model): __tablename__ = 'Artists' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String) phone = db.Column(db.String(120)) website_link = db.Column(db.String(500)) image_link = db.Column(db.String(500)) facebook_link = db.Column(db.String(120)) seeking_venue = db.Column(db.Boolean) seeking_description = db.Column(db.String(500)) city_id = db.Column(db.Integer, db.ForeignKey('Cities.id'), nullable=False) city = db.relationship('City', back_populates='artists', lazy='joined') shows = db.relationship('Show', back_populates='artist', lazy='joined') genres = db.relationship("Genre", secondary=artistgenre_table, back_populates="artists", lazy='joined')
class Genre(db.Model): __tablename__ = 'Genres' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) venues = db.relationship("Venue", secondary=venuegenre_table, back_populates="genres") artists = db.relationship("Artist", secondary=artistgenre_table, back_populates="genres")