-
Notifications
You must be signed in to change notification settings - Fork 1
/
database.py
56 lines (40 loc) · 2.39 KB
/
database.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
import sqlite3
# connects or creates database, and a cursor for it
con = sqlite3.connect('inCollege.db')
cursor = con.cursor()
# Creates table if it was not built before
cursor.execute('''CREATE TABLE IF NOT EXISTS users
(firstName, lastName, username, password, friend)''') #friend stores Plus or Standard 2 or 1
cursor.execute('''CREATE TABLE IF NOT EXISTS skills
(username, skills)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS jobs
(username, title, description, employer, location, salary)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS settings
(username, email, SMS, ads, language)''')
#handling PROFILE
cursor.execute('''CREATE TABLE IF NOT EXISTS about
(username, title, major, university, description)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS experience
(username, job_title, employer , date_start, date_finish, location , e_description)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS education
(username, school , degree , years)''')
# how i see it
# each user needs their potential friend added as a friends_user and set to "pending" for status
# if accepted both entries on the table should be converted to "accepted"
# if declined both entries should be deleted from table
cursor.execute('''CREATE TABLE IF NOT EXISTS friends
(username, friends_user, status)''')
# status can be "saved" "applied" or "deleted"
# posed parameter is username of job poster
cursor.execute('''CREATE TABLE IF NOT EXISTS app_status
(username, title, posted, status)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS applications
(username, title, employer, grad_date, start_date, best_fit)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS messages
(sender, recipient, text)''')
# cursor.execute('''CREATE TABLE IF NOT EXISTS courses
# (username, course0 INTEGER DEFAULT 0, course1 INTEGER DEFAULT 0, course2 INTERGER DEFAULT 0, course3 INTEGER DEFAULT 0
# , course4 INTEGER DEFAULT 0)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS courses
(courses INTEGER , username)''')
cursor.execute('''CREATE TABLE IF NOT EXISTS coursenames (courses)''')