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