-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
50 lines (41 loc) · 1.73 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Models.
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Venue(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
city = db.Column(db.String(120))
state = db.Column(db.String(120))
address = db.Column(db.String(120))
phone = db.Column(db.String(120))
image_link = db.Column(db.String(500))
facebook_link = db.Column(db.String(120))
genres = db.Column(db.String(120))
website = db.Column(db.String(500))
seeking_talent = db.Column(db.Boolean)
seeking_description = db.Column(db.String(120))
shows = db.relationship("Show", backref="venue", lazy=True)
def __repr__(self):
return '<Venue: {} - {} >'.format(self.id, self.name)
class Artist(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(500))
city = db.Column(db.String(500))
state = db.Column(db.String(500))
phone = db.Column(db.String(500))
genres = db.Column(db.String(500))
website = db.Column(db.String(500))
image_link = db.Column(db.String(500))
facebook_link = db.Column(db.String(500))
seeking_venue = db.Column(db.Boolean)
seeking_description = db.Column(db.String(500))
shows = db.relationship("Show", backref="artist", lazy=True)
def __repr__(self):
return '<Artist: {} - {} >'.format(self.id, self.name)
class Show(db.Model):
id = db.Column(db.Integer, primary_key=True)
artist_id = db.Column(db.Integer, db.ForeignKey('artist.id'), nullable=False)
venue_id = db.Column(db.Integer, db.ForeignKey('venue.id'), nullable=True)
start_time = db.Column(db.DateTime, nullable=False)
def __repr__(self):
return '<Show: {} - {} >'.format(self.id, self.start_time)