This repository has been archived by the owner on Aug 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
102 lines (78 loc) · 2.23 KB
/
schema.sql
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
-- SQLite schema
PRAGMA encoding = "UTF-8";
PRAGMA foreign_keys = ON;
CREATE TABLE if not exists profile (
userid INTEGER PRIMARY KEY,
name TEXT NOT NULL,
fullname TEXT NOT NULL,
description TEXT NOT NULL,
jointime INTEGER NOT NULL,
lastloggedin INTEGER NOT NULL
);
CREATE TABLE if not exists userlogin (
userid INTEGER PRIMARY KEY,
githubuser TEXT NOT NULL,
FOREIGN KEY(userid) REFERENCES profile(userid)
);
CREATE TABLE if not exists useravatar (
userid INTEGER PRIMARY KEY,
avatarurl TEXT NOT NULL,
FOREIGN KEY(userid) REFERENCES profile(userid)
);
CREATE TABLE if not exists project (
projectid INTEGER PRIMARY KEY,
projectuid TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
description TEXT NOT NULL,
githubrepo TEXT NOT NULL,
creator INTEGER NOT NULL,
createtime INTEGER NOT NULL,
FOREIGN KEY(creator) REFERENCES profile(userid)
);
CREATE TABLE if not exists userprojectinterest (
userid INTEGER NOT NULL,
projectid INTEGER NOT NULL,
PRIMARY KEY (userid, projectid),
FOREIGN KEY(userid) REFERENCES profile(userid),
FOREIGN KEY(projectid) REFERENCES project(projectid)
);
CREATE TABLE if not exists skill (
skillid INTEGER PRIMARY KEY,
name TEXT NOT NULL,
description TEXT NOT NULL
);
CREATE TABLE if not exists userskill (
userid INTEGER NOT NULL,
skillid INTEGER NOT NULL,
skillstate INTEGER NOT NULL,
PRIMARY KEY (userid, skillid),
FOREIGN KEY(userid) REFERENCES profile(userid),
FOREIGN KEY(skillid) REFERENCES skill(skillid)
);
CREATE TABLE if not exists projectskill (
projectid INTEGER NOT NULL,
skillid INTEGER NOT NULL,
PRIMARY KEY (projectid, skillid),
FOREIGN KEY(projectid) REFERENCES project(projectid),
FOREIGN KEY(skillid) REFERENCES skill(skillid)
);
CREATE TABLE if not exists projectimage (
projectid INTEGER NOT NULL PRIMARY KEY,
originalimage TEXT, -- inflate to file
originalimagemime TEXT,
convertedimage TEXT, -- inflate to file
convertedimagemime TEXT,
FOREIGN KEY(projectid) REFERENCES project(projectid)
)
CREATE TABLE if not exists event (
eventid INTEGER NOT NULL PRIMARY KEY,
typeid INTEGER NOT NULL,
timestamp INTEGER
FOREIGN KEY(typeid) REFERENCES eventtype(typeid)
)
-- 1 feed entry
-- 2 github event
CREATE TABLE if not exists eventtype (
typeid INTEGER,
typename TEXT
)