forked from xcwill/CMeKG_labelingPlatform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
75 lines (57 loc) · 2.5 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
from _init_ import db
class User(db.Model):
__tablename__ = 'users'
username = db.Column(db.String(32), primary_key=True)
email = db.Column(db.String(32), unique=True, nullable=False)
password = db.Column(db.String(32), nullable=False)
role = db.Column(db.String(32), nullable=False)
def is_authenticated(self):
return True
def is_active(self):
return True
def is_anonymous(self):
return False
def get_id(self):
return self.username
class Code(db.Model):
__tablename__ = 'codes'
email = db.Column(db.String(32), unique=True, nullable=False, primary_key=True)
code = db.Column(db.String(32), nullable=False)
time = db.Column(db.String(32), nullable=False)
class File(db.Model):
__tablename__ = 'files'
name = db.Column(db.String(32), unique=True, nullable=False, primary_key=True)
type = db.Column(db.String(32), nullable=False)
count = db.Column(db.String(32), nullable=False)
time = db.Column(db.String(32), nullable=False)
user = db.Column(db.String(32), nullable=False)
words = db.Column(db.String(32), nullable=False)
class Task(db.Model):
__tablename__ = 'tasks'
name = db.Column(db.String(32), unique=True, nullable=False, primary_key=True)
type = db.Column(db.String(32), nullable=False)
count = db.Column(db.String(32), nullable=False)
time = db.Column(db.String(32), nullable=False)
user = db.Column(db.String(32), nullable=False)
words = db.Column(db.String(32), nullable=False)
class Group(db.Model):
__tablename__ = 'groups'
group_name = db.Column(db.String(32), unique=True, nullable=False, primary_key=True)
class Task_User(db.Model):
__tablename__ = 'task_user'
name = db.Column(db.String(32), nullable=False, primary_key=True)
username = db.Column(db.String(32), nullable=False, primary_key=True)
class Task_Group(db.Model):
__tablename__ = 'task_group'
name = db.Column(db.String(32), nullable=False, primary_key=True)
group_name = db.Column(db.String(32), nullable=False, primary_key=True)
class Group_user(db.Model):
__tablename__ = 'group_user'
group_name = db.Column(db.String(32), nullable=False, primary_key=True)
username = db.Column(db.String(32), nullable=False, primary_key=True)
class Task_File(db.Model):
__tablename__ = 'task_file'
task_name = db.Column(db.String(32), nullable=False, primary_key=True)
file_name = db.Column(db.String(32), nullable=False, primary_key=True)
if __name__ == '__main__':
db.create_all()