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