-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_init.py
52 lines (44 loc) · 1.3 KB
/
db_init.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
#!/usr/bin/env python
from config import db, engine, db_session
from models import *
from social.apps.flask_app.default import models
def main():
models.PSABase.metadata.create_all(engine)
db_session.commit()
db.create_all()
fundingCategory = [
'Summer',
'Research',
'Study Abroad',
'Internship',
'Travel',
'Academic Grant',
'Crowdfunding',
'Study/Research Grant',
'Internship/Abroad'
]
for fundingCategory in fundingCategory:
db.session.add(FundingCategory(name=fundingCategory))
fundingSchools = [
('CFA', 'College of Fine Arts'),
('CIT', 'College of Engineering'),
('MCS', 'Mellon College of Science'),
('TSB', 'Tepper School of Business'),
('BXA', 'Interdisciplinary Programs'),
('SCS', 'School of Computer Science'),
('HSS', 'Dietrich College of Humanities & Social Sciences')
]
for fundingSchool in fundingSchools:
db.session.add(FundingSchool(*fundingSchool))
fundingYears = [
'freshman',
'sophomore',
'junior',
'senior',
'graduate'
]
for fundingYear in fundingYears:
db.session.add(FundingYear(name=fundingYear))
db.session.commit()
if __name__ == '__main__':
main()