-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_db.sql
57 lines (43 loc) · 1.36 KB
/
init_db.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
create table admin.post (
id serial not null primary key,
title text not null,
body text,
img text,
posted_at timestamp default now()
);
alter table admin.post add column is_public boolean default true;
CREATE INDEX on admin.post (is_public) where (is_public = True);
create unique index on admin.post (id);
create index on admin.post (title);
create index on admin.post (body);
create index on admin.post (posted_at);
CREATE table admin.exercise (
id bigserial not null primary key,
title text,
category text not null,
file_path text not null,
uploaded_at timestamp default now()
);
create unique index on admin.exercise (id);
create index on admin.exercise (category);
create index on admin.exercise (uploaded_at);
CREATE TABLE admin.success (
id serial not null primary key,
full_name text not null,
school_year int not null,
university text not null,
promoted boolean default false
)
;
create unique index on admin.success (id);
create index on admin.success (school_year);
create index on admin.success (full_name);
create index on admin.success (promoted) where (promoted = true);
CREATE TABLE admin.newsletter (
id serial not null primary key,
email text not null,
registered_at TIMESTAMP;
);
create unique index on admin.newsletter (id);
create index on admin.newsletter (email);
create index on admin.newsletter (registered_at);