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