-
Notifications
You must be signed in to change notification settings - Fork 1
/
models.py
81 lines (57 loc) · 2.43 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Prompt(db.Model):
__tablename__ = 'prompts'
id = db.Column(db.Integer, primary_key=True)
prompt = db.Column(db.String)
class Theme(db.Model):
__tablename__ = 'theme'
id = db.Column(db.Integer, primary_key=True)
theme_name = db.Column(db.String)
description = db.Column(db.String)
class PromptTheme(db.Model):
__tablename__ = 'promptTheme'
prompt_id = db.Column(db.Integer, db.ForeignKey(Prompt.id), primary_key=True)
theme_id = db.Column(db.Integer, db.ForeignKey(Theme.id), primary_key=True)
prompt = db.relationship(Prompt)
theme = db.relationship(Theme)
class ImageSource(db.Model):
__tablename__ = 'imageSource'
id = db.Column(db.Integer, primary_key=True)
source = db.Column(db.String)
class Image(db.Model):
__tablename__ = 'image'
id = db.Column(db.Integer, primary_key=True)
prompt_id = db.Column(db.Integer, db.ForeignKey(Prompt.id))
source_id = db.Column(db.Integer, db.ForeignKey(ImageSource.id))
image = db.Column(db.String)
prompt = db.relationship(Prompt)
source = db.relationship(ImageSource)
class FakePromptSource(db.Model):
__tablename__ = 'fakePromptSource'
id = db.Column(db.Integer, primary_key=True)
source = db.Column(db.String)
class FakePrompt(db.Model):
__tablename__ = 'fakePrompt'
id = db.Column(db.Integer, primary_key=True)
image_id = db.Column(db.Integer, db.ForeignKey(Image.id))
source_id = db.Column(db.Integer, db.ForeignKey(FakePromptSource.id))
fake_prompt = db.Column(db.String)
image = db.relationship(Image)
source = db.relationship(FakePromptSource)
class Play(db.Model):
__tablename__ = 'play'
id = db.Column(db.Integer, primary_key=True)
multiple_choice = db.Column(db.Boolean)
theme = db.Column(db.Integer, db.ForeignKey(Theme.id))
image = db.Column(db.Integer, db.ForeignKey(Image.id))
class MultipleChoiceOption(db.Model):
__tablename__ = 'multipleChoiceOption'
play_id = db.Column(db.Integer, db.ForeignKey(Play.id), primary_key=True)
fake_prompt_id = db.Column(db.Integer, db.ForeignKey(FakePrompt.id), primary_key=True)
selected = db.Column(db.Boolean)
class PlayerInput(db.Model):
__tablename__ = 'playerInput'
play_id = db.Column(db.Integer, db.ForeignKey(Play.id), primary_key=True)
prompt_id = db.Column(db.Integer, db.ForeignKey(Prompt.id))
score = db.Column(db.Float)