-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
49 lines (39 loc) · 1.93 KB
/
models.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
import datetime
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.dialects.postgresql import ARRAY
db = SQLAlchemy()
class Venue(db.Model):
__tablename__ = 'venues'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
city = db.Column(db.String(120), nullable=False)
state = db.Column(db.String(120), nullable=False)
address = db.Column(db.String(120), nullable=False)
phone = db.Column(db.String(120), nullable=False)
genres = db.Column(db.String(120), nullable=False)
website = db.Column(db.String(200), nullable=False)
facebook_link = db.Column(db.String(120), nullable=False)
seeking_talent = db.Column(db.Boolean, nullable=False, default=False)
seeking_description = db.Column(db.String(200))
image_link = db.Column(db.String(500), nullable=False)
shows = db.relationship('Show', backref='venue')
class Artist(db.Model):
__tablename__ = 'artists'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
city = db.Column(db.String(120), nullable=False)
state = db.Column(db.String(120), nullable=False)
phone = db.Column(db.String(120), nullable=False)
genres = db.Column(db.String(), nullable=False)
website = db.Column(db.String(200), nullable=False)
facebook_link = db.Column(db.String(120), nullable=False)
seeking_venue = db.Column(db.Boolean, nullable=False, default=False)
seeking_description = db.Column(db.String(200))
image_link = db.Column(db.String(500), nullable=False)
shows = db.relationship('Show', backref='artist')
class Show(db.Model):
__tablename__ = 'show'
id = db.Column(db.Integer, primary_key=True)
start_time = db.Column(db.DateTime(), default=datetime.datetime.now, nullable=False)
venue_id = db.Column(db.Integer, db.ForeignKey('venues.id'), nullable=False)
artist_id = db.Column(db.Integer, db.ForeignKey('artists.id'), nullable=False)