-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_setup.sql
More file actions
32 lines (27 loc) · 822 Bytes
/
db_setup.sql
File metadata and controls
32 lines (27 loc) · 822 Bytes
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
CREATE schema cdn;
CREATE schema gfx;
CREATE TABLE cdn.media (
media_id UUID PRIMARY KEY,
media_class VARCHAR(16),
hash VARCHAR(1024) UNIQUE
);
CREATE TABLE cdn.links (
media_id UUID REFERENCES cdn.media(media_id) ON DELETE CASCADE,
link VARCHAR(128) NOT NULL,
ttl TIMESTAMP
);
CREATE TABLE gfx.templates(
template_id UUID REFERENCES cdn.media(media_id) ON DELETE CASCADE,
template_type VARCHAR(16),
tournament_id INTEGER,
UNIQUE(template_type, tournament_id)
);
CREATE TABLE gfx.template_components(
template_id UUID REFERENCES gfx.templates(template_id) ON DELETE CASCADE,
component_type VARCHAR(8),
component_value JSONB
);
CREATE TABLE gfx.fonts(
font_path VARCHAR(128) REFERENCES cdn.links(link) ON DELETE CASCADE,
tournament_id INTEGER PRIMARY KEY
);