-
Notifications
You must be signed in to change notification settings - Fork 2
/
alumni_network.sql
73 lines (68 loc) · 1.98 KB
/
alumni_network.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
create table if not exists accounts
(
id varchar(100) primary key,
user_name varchar(50) not null,
role varchar(20) not null,
password varchar not null,
app_id varchar(100) not null,
created_at bigint,
updated_at bigint
);
create table if not exists users
(
id varchar(100) PRIMARY KEY,
institution_id varchar(100),
account_id varchar(100) unique,
full_name varchar,
educational_detail json default '{}',
contact_detail json default '{}',
career_detail json default '{}',
personal_detail json default '{}',
created_at bigint,
updated_at bigint,
foreign key (account_id) references accounts (id)
);
create table if not exists institutions
(
id varchar(100) PRIMARY KEY,
name varchar,
address_detail json default '{}',
contact_info json default '{}',
institution_detail json default '{}',
created_at bigint,
updated_at bigint,
app_id varchar(100)
);
create table if not exists threads
(
id varchar(100) PRIMARY KEY,
title varchar,
body json default '{}',
user_id varchar(100),
status varchar(50),
created_at bigint,
updated_at bigint,
app_id varchar(100),
foreign key (user_id) references users (id)
);
create table if not exists thread_replies
(
id varchar(100) PRIMARY KEY,
body json default '{}',
thread_id varchar(100),
user_id varchar(100),
created_at bigint,
updated_at bigint,
foreign key (thread_id) references threads (id),
foreign key (user_id) references users (id)
);
create table if not exists reactions
(
id varchar(100) PRIMARY KEY,
type varchar(25),
user_id varchar(100),
reply_id varchar(100),
created_at bigint,
updated_at bigint,
foreign key (user_id) references users (id)
);