-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
45 lines (39 loc) · 1.21 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
DROP TABLE IF EXISTS modification, image, imageTag, list, listTag, listEntry CASCADE;
CREATE TABLE modification (
ModificationTime timestamp with time zone
);
INSERT INTO modification VALUES (now());
CREATE TABLE image (
Digest text PRIMARY KEY,
MediaType text,
Architecture text,
OS text,
Annotations jsonb,
Labels jsonb
);
CREATE INDEX imageAnnotations ON image USING gin(Annotations);
CREATE TABLE imageTag (
Repository text,
Tag text,
Image text REFERENCES image(Digest)
);
CREATE UNIQUE INDEX imageTagPKey ON imageTag ( Repository, Tag );
CREATE INDEX imageTagTag ON imageTag ( Tag );
CREATE TABLE list (
Digest text PRIMARY KEY,
MediaType text,
Annotations jsonb
);
CREATE INDEX listAnnotations ON list USING gin(Annotations);
CREATE TABLE listTag (
Repository text,
Tag text,
List text REFERENCES list(Digest)
);
CREATE UNIQUE INDEX listTagPKey ON listTag ( Repository, Tag );
CREATE INDEX listTagTag ON listTag ( Tag );
CREATE TABLE listEntry (
List text REFERENCES list(Digest) ON DELETE CASCADE,
Image text REFERENCES image(Digest)
);
CREATE UNIQUE INDEX listEntryPKey ON listEntry ( List, Image );