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