forked from philipmat/discogs-xml2db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_tables.sql
216 lines (182 loc) · 4.1 KB
/
create_tables.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = discogs;
SET default_tablespace = '';
SET default_with_oids = false;
SET synchronous_commit=off;
CREATE UNLOGGED TABLE artist (
id integer NOT NULL,
name text NOT NULL,
realname text,
urls text[],
namevariations text[],
aliases text[],
releases integer[],
profile text,
members text[],
groups text[],
data_quality text
);
CREATE UNLOGGED TABLE artists_images (
artist_id integer,
type text,
height integer,
width integer,
image_uri text
);
CREATE UNLOGGED TABLE country (
name text
);
CREATE UNLOGGED TABLE format (
name text NOT NULL
);
CREATE UNLOGGED TABLE genre (
id integer NOT NULL,
name text,
parent_genre integer,
sub_genre integer
);
CREATE UNLOGGED TABLE label (
id integer NOT NULL,
name text NOT NULL,
contactinfo text,
profile text,
parent_label text,
sublabels text[],
urls text[],
data_quality text
);
CREATE UNLOGGED TABLE labels_images (
label_id integer,
type text,
height integer,
width integer,
image_uri text
);
CREATE UNLOGGED TABLE release (
id integer NOT NULL,
status text,
title text,
country text,
released text,
barcode text,
notes text,
genres text,
styles text,
master_id int,
data_quality text
);
CREATE UNLOGGED TABLE releases_artists (
release_id integer,
"position" integer,
artist_id integer,
artist_name text,
anv text,
join_relation text
);
CREATE UNLOGGED TABLE releases_extraartists (
release_id integer,
artist_id integer,
artist_name text,
anv text,
role text
);
CREATE UNLOGGED TABLE releases_formats (
release_id integer,
"position" integer,
format_name text,
qty numeric(100, 0),
descriptions text[]
);
CREATE UNLOGGED TABLE releases_images (
release_id integer,
type text,
height integer,
width integer,
image_uri text
);
CREATE UNLOGGED TABLE releases_labels (
label text,
release_id integer,
catno text
);
CREATE UNLOGGED TABLE role (
role_name text
);
CREATE UNLOGGED TABLE track (
release_id integer,
"position" text,
track_id text,
title text,
duration text,
trackno integer
);
CREATE UNLOGGED TABLE tracks_artists (
track_id text,
"position" integer,
artist_id integer,
artist_name text,
anv text,
join_relation text
);
CREATE UNLOGGED TABLE tracks_extraartists (
track_id text,
artist_id integer,
artist_name text,
anv text,
role text,
data_quality text
);
CREATE UNLOGGED TABLE master (
id integer NOT NULL,
title text,
main_release integer NOT NULL,
year int,
notes text,
genres text,
styles text,
role text,
data_quality text
);
CREATE UNLOGGED TABLE masters_artists (
artist_name text,
master_id integer
);
CREATE UNLOGGED TABLE masters_artists_joins (
artist1 text,
artist2 text,
join_relation text,
master_id integer
);
CREATE UNLOGGED TABLE masters_extraartists (
master_id integer,
artist_name text,
roles text[]
);
CREATE UNLOGGED TABLE masters_formats (
master_id integer,
format_name text,
qty integer,
descriptions text[]
);
CREATE UNLOGGED TABLE masters_images (
master_id integer,
type text,
height integer,
width integer,
image_uri text
);
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = discogs;
SET default_tablespace = '';