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