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 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 Show(db.Model): __tablename__ = 'Shows' id = db.Column(db.Integer, primary_key=True) start_time = db.Column(db.DateTime) venue_id = db.Column(db.Integer, db.ForeignKey('Venues.id'), nullable=False) venue = db.relationship('Venue', back_populates='shows', lazy='joined') artist_id = db.Column(db.Integer, db.ForeignKey('Artists.id'), nullable=False) artist = db.relationship('Artist', back_populates='shows', 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")
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 Venue(db.Model): __tablename__ = 'Venues' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String) phone = db.Column(db.String(120)) address = 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_talent = 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='venues', lazy='joined') shows = db.relationship('Show', back_populates='venue', lazy='joined') genres = db.relationship("Genre", secondary=venuegenre_table, back_populates="venues", 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))
from data_access import db artistgenre_table = db.Table( 'ArtistsGenres', db.Column('artist_id', db.Integer, db.ForeignKey('Artists.id'), primary_key=True), db.Column('genre_id', db.Integer, db.ForeignKey('Genres.id'), primary_key=True))
from data_access import db venuegenre_table = db.Table('VenuesGenres', db.Column('venue_id', db.Integer, db.ForeignKey('Venues.id'), primary_key=True), db.Column('genre_id', db.Integer, db.ForeignKey('Genres.id'), primary_key=True) )
from data_access import db movie_genre_table = db.Table("movies_genres", db.Column("movie_id", db.Integer, db.ForeignKey("movies.id"), primary_key=True), db.Column("genre_id", db.Integer, db.ForeignKey("genres.id"), primary_key=True))
from data_access import db movie_language_table = db.Table( "movies_languages", db.Column("movie_id", db.Integer, db.ForeignKey("movies.id"), primary_key=True), db.Column("language_id", db.Integer, db.ForeignKey("languages.id"), primary_key=True))