示例#1
0
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')
示例#2
0
文件: Actor.py 项目: vgotra/FSND
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))
示例#3
0
文件: Movie.py 项目: vgotra/FSND
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")
示例#4
0
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")
示例#5
0
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')
示例#6
0
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")