-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.py
37 lines (25 loc) · 1018 Bytes
/
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
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# class Survey(Base):
# __tablename__ = 'Surveys'
#
# survey_id = Column(Integer, primary_key=True, autoincrement=True)
# title = Column(String)
# data = Column(Text)
class Vote(db.Model):
__tablename__ = 'Votes'
vote_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_hash = db.Column(db.String)
datestamp = db.Column(db.DateTime)
# survey_id = Column(Integer, ForeignKey('Survey.id'))
# survey = relationship('Survey', backref='votes')
class Answer(db.Model):
__tablename__ = 'Answers'
answer_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
code = db.Column(db.String, primary_key=True)
answer_value = db.Column(db.String)
vote_id = db.Column(db.Integer, db.ForeignKey('Votes.vote_id'))
vote = db.relationship('Vote', backref='answers')
class Receipt(db.Model):
__tablename__ = 'Receipts'
user_id = db.Column(db.String, primary_key=True)