-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_db.py
42 lines (35 loc) · 1015 Bytes
/
create_db.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
from teams.database import engine
from teams.models import Base
from teams.database import session
from teams.models import User, UserRole
from teams.auth2 import pwd_context
from teams.des_enc import des_obj
Base.metadata.create_all(engine)
admin = User()
admin.set_name('peter')
admin.set_email('[email protected]')
admin.set_password('2001')
admin.set_role('admin')
teacher = User()
teacher.set_name('john')
teacher.set_email('[email protected]')
teacher.set_password('2001')
teacher.set_role('teacher')
student = User()
student.set_name('sam')
student.set_email('[email protected]')
student.set_password('2001')
student.set_role('student')
teacher2 = User()
teacher2.set_name('jack')
teacher2.set_email('[email protected]')
teacher2.set_password('2001')
teacher2.set_role('teacher')
student2 = User()
student2.set_name('edd')
student2.set_email('[email protected]')
student2.set_password('2001')
student2.set_role('student')
session.add_all((admin, teacher, student, student2, teacher2))
session.commit()
session.close()