-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0000_schema.sql
82 lines (74 loc) · 1.94 KB
/
0000_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
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
74
75
76
77
78
79
80
81
82
-- Migration number: 0000 2023-10-01T20:08:40.343Z
CREATE TABLE
"artifacts" (
"id" integer PRIMARY KEY,
"slug" text NOT NULL,
"title" text NOT NULL,
"summary" text NOT NULL,
"description" text,
"from_year" integer NOT NULL,
"to_year" integer
);
CREATE TABLE
"artifact_versions" (
"id" integer PRIMARY KEY,
"artifact_id" text NOT NULL,
"version" integer NOT NULL,
"artifact" integer NOT NULL UNIQUE REFERENCES "artifacts" ("id"),
"created_at" integer NOT NULL,
UNIQUE ("artifact_id", "version")
);
CREATE TABLE
"artifact_aliases" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"slug" text NOT NULL,
UNIQUE ("artifact", "slug")
);
CREATE TABLE
"links" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"name" text NOT NULL,
"url" text NOT NULL
);
CREATE TABLE
"files" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"filename" text NOT NULL,
"name" text NOT NULL,
"media_type" text,
"multihash" text NOT NULL,
"lang" text,
"hidden" boolean NOT NULL,
UNIQUE ("artifact", "filename")
);
CREATE TABLE
"file_aliases" (
"id" integer PRIMARY KEY,
"file" integer NOT NULL REFERENCES "files" ("id"),
"filename" text NOT NULL,
UNIQUE ("file", "filename")
);
CREATE TABLE
"people" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"name" text NOT NULL,
UNIQUE ("artifact", "name")
);
CREATE TABLE
"identities" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"name" text NOT NULL,
UNIQUE ("artifact", "name")
);
CREATE TABLE
"decades" (
"id" integer PRIMARY KEY,
"artifact" integer NOT NULL REFERENCES "artifacts" ("id"),
"decade" integer NOT NULL,
UNIQUE ("artifact", "decade")
);