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