-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.sql
More file actions
73 lines (67 loc) · 2.01 KB
/
schema.sql
File metadata and controls
73 lines (67 loc) · 2.01 KB
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
drop table drafts;
drop table revisions;
drop table pages;
drop table designs;
drop table sites;
create table sites (
id serial primary key,
secret_url text not null,
public_url text,
title text,
subtitle text,
email text,
password text,
change_pwd_token text,
security text, -- private | public | open
show_primer boolean not null default true,
deleted boolean not null default false,
created timestamp not null default (current_timestamp at time zone 'utc'),
partner text
);
create table designs (
id serial primary key,
site_id int not null references sites(id),
header_color text,
title_color text,
title_font text,
title_size int default 100,
subtitle_color text,
subtitle_font text,
subtitle_size int default 100,
content_font text,
content_size int default 100,
headings_font text,
headings_size int default 100,
hue text,
brightness text
);
create table pages (
id serial primary key,
site_id int not null references sites(id),
name text not null,
caret_pos int not null default 0,
scroll_pos int not null default 0,
deleted boolean not null default false,
unique (site_id, name),
created timestamp not null default (current_timestamp at time zone 'utc')
);
create table revisions (
id serial primary key,
page_id int not null references pages(id),
revision int not null,
content text not null,
changes text,
ip text,
created timestamp not null default (current_timestamp at time zone 'utc')
);
create table drafts (
id serial primary key,
page_id int not null references pages(id),
content text not null,
created timestamp not null default (current_timestamp at time zone 'utc')
);
create index sites_secret_url_idx on sites (secret_url);
create index sites_public_url_idx on sites (public_url);
create index pages_site_id_idx on pages (site_id);
create index revision_page_id_idx on revisions (page_id);
create index designs_site_id_idx on designs (site_id);