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