Commit | Line | Data |
0009fa49 |
1 | -- |
2 | -- Created by SQL::Translator::Producer::SQLite |
9beded8a |
3 | -- Created on Sun Feb 22 00:15:06 2009 |
0009fa49 |
4 | -- |
0009fa49 |
5 | |
0009fa49 |
6 | |
084a2c0a |
7 | BEGIN TRANSACTION; |
8 | |
0009fa49 |
9 | -- |
10 | -- Table: artist |
11 | -- |
12 | CREATE TABLE artist ( |
13 | artistid INTEGER PRIMARY KEY NOT NULL, |
39da2a2b |
14 | name varchar(100), |
a0dd8679 |
15 | rank integer NOT NULL DEFAULT '13', |
16 | charfield char(10) |
0009fa49 |
17 | ); |
18 | |
19 | -- |
ebf846e8 |
20 | -- Table: artist_undirected_map |
9c2c91ea |
21 | -- |
ebf846e8 |
22 | CREATE TABLE artist_undirected_map ( |
9c2c91ea |
23 | id1 integer NOT NULL, |
24 | id2 integer NOT NULL, |
9c2c91ea |
25 | PRIMARY KEY (id1, id2) |
26 | ); |
27 | |
ebf846e8 |
28 | CREATE INDEX artist_undirected_map_idx_id1_ ON artist_undirected_map (id1); |
084a2c0a |
29 | |
ebf846e8 |
30 | CREATE INDEX artist_undirected_map_idx_id2_ ON artist_undirected_map (id2); |
31 | |
9c2c91ea |
32 | -- |
4f6386b0 |
33 | -- Table: cd_artwork |
34 | -- |
35 | CREATE TABLE cd_artwork ( |
36 | cd_id INTEGER PRIMARY KEY NOT NULL |
37 | ); |
38 | |
39 | CREATE INDEX cd_artwork_idx_cd_id_cd_artwor ON cd_artwork (cd_id); |
40 | |
41 | -- |
6ffb5be5 |
42 | -- Table: artwork_to_artist |
43 | -- |
44 | CREATE TABLE artwork_to_artist ( |
45 | artwork_cd_id integer NOT NULL, |
46 | artist_id integer NOT NULL, |
47 | PRIMARY KEY (artwork_cd_id, artist_id) |
48 | ); |
49 | |
50 | CREATE INDEX artwork_to_artist_idx_artist_id_artwork_to_arti ON artwork_to_artist (artist_id); |
9beded8a |
51 | |
6ffb5be5 |
52 | CREATE INDEX artwork_to_artist_idx_artwork_cd_id_artwork_to_ ON artwork_to_artist (artwork_cd_id); |
53 | |
54 | -- |
6ec7d1bb |
55 | -- Table: bindtype_test |
56 | -- |
57 | CREATE TABLE bindtype_test ( |
58 | id INTEGER PRIMARY KEY NOT NULL, |
59 | bytea blob, |
60 | blob blob, |
61 | clob clob |
62 | ); |
63 | |
6ec7d1bb |
64 | -- |
ebf846e8 |
65 | -- Table: bookmark |
3bd6e3e0 |
66 | -- |
ebf846e8 |
67 | CREATE TABLE bookmark ( |
68 | id INTEGER PRIMARY KEY NOT NULL, |
69 | link integer NOT NULL |
3bd6e3e0 |
70 | ); |
71 | |
ebf846e8 |
72 | CREATE INDEX bookmark_idx_link_bookmark ON bookmark (link); |
73 | |
3bd6e3e0 |
74 | -- |
ebf846e8 |
75 | -- Table: books |
0009fa49 |
76 | -- |
ebf846e8 |
77 | CREATE TABLE books ( |
78 | id INTEGER PRIMARY KEY NOT NULL, |
79 | source varchar(100) NOT NULL, |
80 | owner integer NOT NULL, |
cda5e082 |
81 | title varchar(100) NOT NULL, |
82 | price integer |
0009fa49 |
83 | ); |
84 | |
85 | -- |
0009fa49 |
86 | -- Table: cd |
87 | -- |
88 | CREATE TABLE cd ( |
89 | cdid INTEGER PRIMARY KEY NOT NULL, |
90 | artist integer NOT NULL, |
8fcf21b3 |
91 | title varchar(100) NOT NULL, |
370f2ba2 |
92 | year varchar(100) NOT NULL, |
a1cb5921 |
93 | genreid integer, |
94 | single_track integer |
370f2ba2 |
95 | ); |
96 | |
ebf846e8 |
97 | CREATE INDEX cd_idx_artist_cd ON cd (artist); |
084a2c0a |
98 | |
ebf846e8 |
99 | CREATE INDEX cd_idx_genreid_cd ON cd (genreid); |
084a2c0a |
100 | |
a1cb5921 |
101 | CREATE INDEX cd_idx_single_track_cd ON cd (single_track); |
084a2c0a |
102 | |
ebf846e8 |
103 | CREATE UNIQUE INDEX cd_artist_title_cd ON cd (artist, title); |
104 | |
370f2ba2 |
105 | -- |
ebf846e8 |
106 | -- Table: cd_to_producer |
370f2ba2 |
107 | -- |
ebf846e8 |
108 | CREATE TABLE cd_to_producer ( |
109 | cd integer NOT NULL, |
110 | producer integer NOT NULL, |
111 | PRIMARY KEY (cd, producer) |
0009fa49 |
112 | ); |
113 | |
ebf846e8 |
114 | CREATE INDEX cd_to_producer_idx_cd_cd_to_pr ON cd_to_producer (cd); |
084a2c0a |
115 | |
ebf846e8 |
116 | CREATE INDEX cd_to_producer_idx_producer_cd ON cd_to_producer (producer); |
117 | |
0009fa49 |
118 | -- |
ebf846e8 |
119 | -- Table: collection |
0009fa49 |
120 | -- |
ebf846e8 |
121 | CREATE TABLE collection ( |
122 | collectionid INTEGER PRIMARY KEY NOT NULL, |
123 | name varchar(100) NOT NULL |
0009fa49 |
124 | ); |
125 | |
126 | -- |
ebf846e8 |
127 | -- Table: collection_object |
0009fa49 |
128 | -- |
ebf846e8 |
129 | CREATE TABLE collection_object ( |
130 | collection integer NOT NULL, |
131 | object integer NOT NULL, |
132 | PRIMARY KEY (collection, object) |
0009fa49 |
133 | ); |
134 | |
ebf846e8 |
135 | CREATE INDEX collection_object_idx_collection_collection_obj ON collection_object (collection); |
084a2c0a |
136 | |
ebf846e8 |
137 | CREATE INDEX collection_object_idx_object_c ON collection_object (object); |
138 | |
0009fa49 |
139 | -- |
caac1708 |
140 | -- Table: demographic |
141 | -- |
142 | CREATE TABLE demographic ( |
143 | demographicid INTEGER PRIMARY KEY NOT NULL, |
144 | name varchar(100) NOT NULL |
145 | ); |
146 | |
147 | CREATE UNIQUE INDEX demographic_name_demographic ON demographic (name); |
148 | |
149 | -- |
ebf846e8 |
150 | -- Table: employee |
887ce227 |
151 | -- |
ebf846e8 |
152 | CREATE TABLE employee ( |
153 | employee_id INTEGER PRIMARY KEY NOT NULL, |
154 | position integer NOT NULL, |
155 | group_id integer, |
156 | group_id_2 integer, |
9beded8a |
157 | group_id_3 integer, |
ebf846e8 |
158 | name varchar(100) |
887ce227 |
159 | ); |
160 | |
084a2c0a |
161 | -- |
162 | -- Table: encoded |
163 | -- |
164 | CREATE TABLE encoded ( |
165 | id INTEGER PRIMARY KEY NOT NULL, |
166 | encoded varchar(100) |
167 | ); |
ebf846e8 |
168 | |
9fcda149 |
169 | -- |
ebf846e8 |
170 | -- Table: event |
ab8481f5 |
171 | -- |
ebf846e8 |
172 | CREATE TABLE event ( |
ab8481f5 |
173 | id INTEGER PRIMARY KEY NOT NULL, |
ebf846e8 |
174 | starts_at datetime NOT NULL, |
a97fe7e0 |
175 | created_on timestamp NOT NULL, |
176 | varchar_date varchar(20), |
ff8a6e3b |
177 | varchar_datetime varchar(20), |
a0dd8679 |
178 | skip_inflation datetime |
ab8481f5 |
179 | ); |
180 | |
181 | -- |
4740bdb7 |
182 | -- Table: file_columns |
183 | -- |
184 | CREATE TABLE file_columns ( |
185 | id INTEGER PRIMARY KEY NOT NULL, |
ebf846e8 |
186 | file varchar(255) NOT NULL |
4740bdb7 |
187 | ); |
188 | |
189 | -- |
ebf846e8 |
190 | -- Table: forceforeign |
77211009 |
191 | -- |
ebf846e8 |
192 | CREATE TABLE forceforeign ( |
193 | artist INTEGER PRIMARY KEY NOT NULL, |
194 | cd integer NOT NULL |
77211009 |
195 | ); |
196 | |
ebf846e8 |
197 | CREATE INDEX forceforeign_idx_artist_forcef ON forceforeign (artist); |
198 | |
77211009 |
199 | -- |
ebf846e8 |
200 | -- Table: fourkeys |
9c2c91ea |
201 | -- |
ebf846e8 |
202 | CREATE TABLE fourkeys ( |
203 | foo integer NOT NULL, |
204 | bar integer NOT NULL, |
205 | hello integer NOT NULL, |
206 | goodbye integer NOT NULL, |
207 | sensors character NOT NULL, |
208 | PRIMARY KEY (foo, bar, hello, goodbye) |
0009fa49 |
209 | ); |
210 | |
211 | -- |
ebf846e8 |
212 | -- Table: fourkeys_to_twokeys |
0009fa49 |
213 | -- |
ebf846e8 |
214 | CREATE TABLE fourkeys_to_twokeys ( |
215 | f_foo integer NOT NULL, |
216 | f_bar integer NOT NULL, |
217 | f_hello integer NOT NULL, |
218 | f_goodbye integer NOT NULL, |
219 | t_artist integer NOT NULL, |
220 | t_cd integer NOT NULL, |
221 | autopilot character NOT NULL, |
222 | PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd) |
0009fa49 |
223 | ); |
224 | |
ebf846e8 |
225 | CREATE INDEX fourkeys_to_twokeys_idx_f_foo_f_bar_f_hello_f_goodbye_ ON fourkeys_to_twokeys (f_foo, f_bar, f_hello, f_goodbye); |
084a2c0a |
226 | |
ebf846e8 |
227 | CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd_fourkeys_to ON fourkeys_to_twokeys (t_artist, t_cd); |
228 | |
887ce227 |
229 | -- |
ebf846e8 |
230 | -- Table: genre |
887ce227 |
231 | -- |
ebf846e8 |
232 | CREATE TABLE genre ( |
87310237 |
233 | genreid INTEGER PRIMARY KEY NOT NULL, |
caac1708 |
234 | name varchar(100) NOT NULL, |
235 | demographicid INTEGER NOT NULL |
9c2c91ea |
236 | ); |
237 | |
87310237 |
238 | CREATE UNIQUE INDEX genre_name_genre ON genre (name); |
ebf846e8 |
239 | |
240 | -- |
4f6386b0 |
241 | -- Table: images |
242 | -- |
243 | CREATE TABLE images ( |
244 | id INTEGER PRIMARY KEY NOT NULL, |
245 | artwork_id integer NOT NULL, |
246 | name varchar(100) NOT NULL, |
247 | data blob |
248 | ); |
249 | |
250 | CREATE INDEX images_idx_artwork_id_images ON images (artwork_id); |
251 | |
252 | -- |
ebf846e8 |
253 | -- Table: liner_notes |
254 | -- |
255 | CREATE TABLE liner_notes ( |
256 | liner_id INTEGER PRIMARY KEY NOT NULL, |
257 | notes varchar(100) NOT NULL |
258 | ); |
259 | |
6bf6ba2f |
260 | CREATE INDEX liner_notes_idx_liner_id_liner ON liner_notes (liner_id); |
ebf846e8 |
261 | |
262 | -- |
263 | -- Table: link |
264 | -- |
265 | CREATE TABLE link ( |
266 | id INTEGER PRIMARY KEY NOT NULL, |
267 | url varchar(100), |
268 | title varchar(100) |
269 | ); |
270 | |
9c2c91ea |
271 | -- |
4f6386b0 |
272 | -- Table: lyric_versions |
273 | -- |
274 | CREATE TABLE lyric_versions ( |
275 | id INTEGER PRIMARY KEY NOT NULL, |
276 | lyric_id integer NOT NULL, |
277 | text varchar(100) NOT NULL |
278 | ); |
279 | |
280 | CREATE INDEX lyric_versions_idx_lyric_id_ly ON lyric_versions (lyric_id); |
281 | |
282 | -- |
283 | -- Table: lyrics |
284 | -- |
285 | CREATE TABLE lyrics ( |
286 | lyric_id INTEGER PRIMARY KEY NOT NULL, |
287 | track_id integer NOT NULL |
288 | ); |
289 | |
290 | CREATE INDEX lyrics_idx_track_id_lyrics ON lyrics (track_id); |
291 | |
292 | -- |
89034887 |
293 | -- Table: noprimarykey |
294 | -- |
295 | CREATE TABLE noprimarykey ( |
296 | foo integer NOT NULL, |
297 | bar integer NOT NULL, |
298 | baz integer NOT NULL |
299 | ); |
300 | |
ebf846e8 |
301 | CREATE UNIQUE INDEX foo_bar_noprimarykey ON noprimarykey (foo, bar); |
302 | |
89034887 |
303 | -- |
ebf846e8 |
304 | -- Table: onekey |
9c2c91ea |
305 | -- |
ebf846e8 |
306 | CREATE TABLE onekey ( |
307 | id INTEGER PRIMARY KEY NOT NULL, |
308 | artist integer NOT NULL, |
309 | cd integer NOT NULL |
9c2c91ea |
310 | ); |
311 | |
312 | -- |
ebf846e8 |
313 | -- Table: owners |
9c2c91ea |
314 | -- |
ebf846e8 |
315 | CREATE TABLE owners ( |
316 | ownerid INTEGER PRIMARY KEY NOT NULL, |
317 | name varchar(100) NOT NULL |
9c2c91ea |
318 | ); |
319 | |
320 | -- |
321 | -- Table: producer |
322 | -- |
323 | CREATE TABLE producer ( |
324 | producerid INTEGER PRIMARY KEY NOT NULL, |
8fcf21b3 |
325 | name varchar(100) NOT NULL |
887ce227 |
326 | ); |
327 | |
ebf846e8 |
328 | CREATE UNIQUE INDEX prod_name_producer ON producer (name); |
329 | |
9fcda149 |
330 | -- |
ebf846e8 |
331 | -- Table: self_ref |
9fcda149 |
332 | -- |
ebf846e8 |
333 | CREATE TABLE self_ref ( |
8fcf21b3 |
334 | id INTEGER PRIMARY KEY NOT NULL, |
ebf846e8 |
335 | name varchar(100) NOT NULL |
9fcda149 |
336 | ); |
337 | |
78060df8 |
338 | -- |
ebf846e8 |
339 | -- Table: self_ref_alias |
78060df8 |
340 | -- |
ebf846e8 |
341 | CREATE TABLE self_ref_alias ( |
342 | self_ref integer NOT NULL, |
343 | alias integer NOT NULL, |
344 | PRIMARY KEY (self_ref, alias) |
78060df8 |
345 | ); |
346 | |
ebf846e8 |
347 | CREATE INDEX self_ref_alias_idx_alias_self_ ON self_ref_alias (alias); |
084a2c0a |
348 | |
ebf846e8 |
349 | CREATE INDEX self_ref_alias_idx_self_ref_se ON self_ref_alias (self_ref); |
350 | |
78060df8 |
351 | -- |
ebf846e8 |
352 | -- Table: sequence_test |
78060df8 |
353 | -- |
ebf846e8 |
354 | CREATE TABLE sequence_test ( |
355 | pkid1 integer NOT NULL, |
356 | pkid2 integer NOT NULL, |
357 | nonpkid integer NOT NULL, |
358 | name varchar(100), |
359 | PRIMARY KEY (pkid1, pkid2) |
78060df8 |
360 | ); |
361 | |
362 | -- |
ebf846e8 |
363 | -- Table: serialized |
78060df8 |
364 | -- |
ebf846e8 |
365 | CREATE TABLE serialized ( |
366 | id INTEGER PRIMARY KEY NOT NULL, |
367 | serialized text NOT NULL |
78060df8 |
368 | ); |
369 | |
370 | -- |
ebf846e8 |
371 | -- Table: tags |
78060df8 |
372 | -- |
ebf846e8 |
373 | CREATE TABLE tags ( |
374 | tagid INTEGER PRIMARY KEY NOT NULL, |
375 | cd integer NOT NULL, |
376 | tag varchar(100) NOT NULL |
78060df8 |
377 | ); |
378 | |
ebf846e8 |
379 | CREATE INDEX tags_idx_cd_tags ON tags (cd); |
380 | |
78060df8 |
381 | -- |
ebf846e8 |
382 | -- Table: track |
78060df8 |
383 | -- |
ebf846e8 |
384 | CREATE TABLE track ( |
385 | trackid INTEGER PRIMARY KEY NOT NULL, |
386 | cd integer NOT NULL, |
387 | position integer NOT NULL, |
388 | title varchar(100) NOT NULL, |
389 | last_updated_on datetime |
390 | ); |
391 | |
392 | CREATE INDEX track_idx_cd_track ON track (cd); |
084a2c0a |
393 | |
ebf846e8 |
394 | CREATE UNIQUE INDEX track_cd_position_track ON track (cd, position); |
084a2c0a |
395 | |
ebf846e8 |
396 | CREATE UNIQUE INDEX track_cd_title_track ON track (cd, title); |
397 | |
398 | -- |
399 | -- Table: treelike |
400 | -- |
401 | CREATE TABLE treelike ( |
78060df8 |
402 | id INTEGER PRIMARY KEY NOT NULL, |
ebf846e8 |
403 | parent integer, |
404 | name varchar(100) NOT NULL |
405 | ); |
406 | |
407 | CREATE INDEX treelike_idx_parent_treelike ON treelike (parent); |
408 | |
409 | -- |
410 | -- Table: twokeytreelike |
411 | -- |
412 | CREATE TABLE twokeytreelike ( |
413 | id1 integer NOT NULL, |
414 | id2 integer NOT NULL, |
415 | parent1 integer NOT NULL, |
416 | parent2 integer NOT NULL, |
417 | name varchar(100) NOT NULL, |
418 | PRIMARY KEY (id1, id2) |
419 | ); |
420 | |
421 | CREATE INDEX twokeytreelike_idx_parent1_parent2_twokeytre ON twokeytreelike (parent1, parent2); |
084a2c0a |
422 | |
ebf846e8 |
423 | CREATE UNIQUE INDEX tktlnameunique_twokeytreelike ON twokeytreelike (name); |
424 | |
425 | -- |
426 | -- Table: twokeys |
427 | -- |
428 | CREATE TABLE twokeys ( |
429 | artist integer NOT NULL, |
430 | cd integer NOT NULL, |
431 | PRIMARY KEY (artist, cd) |
432 | ); |
433 | |
434 | CREATE INDEX twokeys_idx_artist_twokeys ON twokeys (artist); |
435 | |
436 | -- |
437 | -- Table: typed_object |
438 | -- |
439 | CREATE TABLE typed_object ( |
440 | objectid INTEGER PRIMARY KEY NOT NULL, |
441 | type varchar(100) NOT NULL, |
442 | value varchar(100) NOT NULL |
78060df8 |
443 | ); |
444 | |
0e80c4ca |
445 | -- |
084a2c0a |
446 | -- View: year2000cds |
0e80c4ca |
447 | -- |
084a2c0a |
448 | CREATE VIEW year2000cds AS |
449 | SELECT cdid, artist, title FROM cd WHERE year ='2000'; |
78060df8 |
450 | |
0009fa49 |
451 | COMMIT; |