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