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