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