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