Fully deprecate IC::File
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
243e940e 1--
2-- Created by SQL::Translator::Producer::SQLite
3814fdad 3-- Created on Sat Mar 6 12:26:40 2010
0009fa49 4--
181b2261 5;
084a2c0a 6
0009fa49 7--
8-- Table: artist
9--
10CREATE TABLE artist (
11 artistid INTEGER PRIMARY KEY NOT NULL,
39da2a2b 12 name varchar(100),
a0dd8679 13 rank integer NOT NULL DEFAULT '13',
14 charfield char(10)
0009fa49 15);
16
0fd7e9a3 17CREATE INDEX artist_name_hookidx ON artist (name);
18
0009fa49 19--
6ec7d1bb 20-- Table: bindtype_test
21--
22CREATE TABLE bindtype_test (
23 id INTEGER PRIMARY KEY NOT NULL,
24 bytea blob,
25 blob blob,
26 clob clob
27);
28
6ec7d1bb 29--
ebf846e8 30-- Table: collection
0009fa49 31--
ebf846e8 32CREATE TABLE collection (
33 collectionid INTEGER PRIMARY KEY NOT NULL,
34 name varchar(100) NOT NULL
0009fa49 35);
36
37--
ebf846e8 38-- Table: employee
887ce227 39--
ebf846e8 40CREATE TABLE employee (
41 employee_id INTEGER PRIMARY KEY NOT NULL,
42 position integer NOT NULL,
43 group_id integer,
44 group_id_2 integer,
9beded8a 45 group_id_3 integer,
ebf846e8 46 name varchar(100)
887ce227 47);
48
084a2c0a 49--
50-- Table: encoded
51--
52CREATE TABLE encoded (
53 id INTEGER PRIMARY KEY NOT NULL,
54 encoded varchar(100)
55);
ebf846e8 56
9fcda149 57--
ebf846e8 58-- Table: event
ab8481f5 59--
ebf846e8 60CREATE TABLE event (
ab8481f5 61 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 62 starts_at datetime NOT NULL,
a97fe7e0 63 created_on timestamp NOT NULL,
64 varchar_date varchar(20),
ff8a6e3b 65 varchar_datetime varchar(20),
41308e82 66 skip_inflation datetime,
67 ts_without_tz datetime
ab8481f5 68);
69
70--
ebf846e8 71-- Table: fourkeys
9c2c91ea 72--
ebf846e8 73CREATE TABLE fourkeys (
74 foo integer NOT NULL,
75 bar integer NOT NULL,
76 hello integer NOT NULL,
77 goodbye integer NOT NULL,
ff1234ad 78 sensors character(10) NOT NULL,
79 read_count integer,
ebf846e8 80 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 81);
82
83--
ebf846e8 84-- Table: genre
887ce227 85--
ebf846e8 86CREATE TABLE genre (
87310237 87 genreid INTEGER PRIMARY KEY NOT NULL,
56b73f83 88 name varchar(100) NOT NULL
9c2c91ea 89);
90
eb0bc670 91CREATE UNIQUE INDEX genre_name ON genre (name);
ebf846e8 92
93--
94-- Table: link
95--
96CREATE TABLE link (
97 id INTEGER PRIMARY KEY NOT NULL,
98 url varchar(100),
99 title varchar(100)
100);
101
9c2c91ea 102--
41308e82 103-- Table: money_test
104--
105CREATE TABLE money_test (
106 id INTEGER PRIMARY KEY NOT NULL,
107 amount money
108);
109
110--
89034887 111-- Table: noprimarykey
112--
113CREATE TABLE noprimarykey (
114 foo integer NOT NULL,
115 bar integer NOT NULL,
116 baz integer NOT NULL
117);
118
eb0bc670 119CREATE UNIQUE INDEX foo_bar ON noprimarykey (foo, bar);
ebf846e8 120
89034887 121--
ebf846e8 122-- Table: onekey
9c2c91ea 123--
ebf846e8 124CREATE TABLE onekey (
125 id INTEGER PRIMARY KEY NOT NULL,
126 artist integer NOT NULL,
127 cd integer NOT NULL
9c2c91ea 128);
129
130--
ebf846e8 131-- Table: owners
9c2c91ea 132--
ebf846e8 133CREATE TABLE owners (
bed3a173 134 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 135 name varchar(100) NOT NULL
9c2c91ea 136);
137
138--
139-- Table: producer
140--
141CREATE TABLE producer (
142 producerid INTEGER PRIMARY KEY NOT NULL,
8fcf21b3 143 name varchar(100) NOT NULL
887ce227 144);
145
eb0bc670 146CREATE UNIQUE INDEX prod_name ON producer (name);
ebf846e8 147
9fcda149 148--
ebf846e8 149-- Table: self_ref
9fcda149 150--
ebf846e8 151CREATE TABLE self_ref (
8fcf21b3 152 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 153 name varchar(100) NOT NULL
9fcda149 154);
155
78060df8 156--
ebf846e8 157-- Table: sequence_test
78060df8 158--
ebf846e8 159CREATE TABLE sequence_test (
160 pkid1 integer NOT NULL,
161 pkid2 integer NOT NULL,
162 nonpkid integer NOT NULL,
163 name varchar(100),
164 PRIMARY KEY (pkid1, pkid2)
78060df8 165);
166
167--
ebf846e8 168-- Table: serialized
78060df8 169--
ebf846e8 170CREATE TABLE serialized (
171 id INTEGER PRIMARY KEY NOT NULL,
172 serialized text NOT NULL
78060df8 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
247--
248-- Table: forceforeign
249--
250CREATE TABLE forceforeign (
251 artist INTEGER PRIMARY KEY NOT NULL,
252 cd integer NOT NULL
253);
254
eb0bc670 255--
256-- Table: self_ref_alias
257--
258CREATE TABLE self_ref_alias (
259 self_ref integer NOT NULL,
260 alias integer NOT NULL,
261 PRIMARY KEY (self_ref, alias)
78060df8 262);
263
eb0bc670 264CREATE INDEX self_ref_alias_idx_alias ON self_ref_alias (alias);
265
266CREATE INDEX self_ref_alias_idx_self_ref ON self_ref_alias (self_ref);
ebf846e8 267
78060df8 268--
ebf846e8 269-- Table: track
78060df8 270--
ebf846e8 271CREATE TABLE track (
272 trackid INTEGER PRIMARY KEY NOT NULL,
273 cd integer NOT NULL,
c1d7087d 274 position int NOT NULL,
ebf846e8 275 title varchar(100) NOT NULL,
abc914bd 276 last_updated_on datetime,
09451687 277 last_updated_at datetime,
c0678cfc 278 small_dt smalldatetime
ebf846e8 279);
280
eb0bc670 281CREATE INDEX track_idx_cd ON track (cd);
084a2c0a 282
eb0bc670 283CREATE UNIQUE INDEX track_cd_position ON track (cd, position);
084a2c0a 284
eb0bc670 285CREATE UNIQUE INDEX track_cd_title ON track (cd, title);
ebf846e8 286
287--
eb0bc670 288-- Table: cd
ebf846e8 289--
eb0bc670 290CREATE TABLE cd (
291 cdid INTEGER PRIMARY KEY NOT NULL,
292 artist integer NOT NULL,
293 title varchar(100) NOT NULL,
294 year varchar(100) NOT NULL,
295 genreid integer,
296 single_track integer
297);
298
299CREATE INDEX cd_idx_artist ON cd (artist);
300
301CREATE INDEX cd_idx_genreid ON cd (genreid);
302
303CREATE INDEX cd_idx_single_track ON cd (single_track);
304
305CREATE UNIQUE INDEX cd_artist_title ON cd (artist, title);
306
307--
308-- Table: collection_object
309--
310CREATE TABLE collection_object (
311 collection integer NOT NULL,
312 object integer NOT NULL,
313 PRIMARY KEY (collection, object)
314);
315
316CREATE INDEX collection_object_idx_collection ON collection_object (collection);
317
318CREATE INDEX collection_object_idx_object ON collection_object (object);
319
320--
321-- Table: lyrics
322--
323CREATE TABLE lyrics (
324 lyric_id INTEGER PRIMARY KEY NOT NULL,
325 track_id integer NOT NULL
326);
327
328CREATE INDEX lyrics_idx_track_id ON lyrics (track_id);
329
330--
331-- Table: cd_artwork
332--
333CREATE TABLE cd_artwork (
334 cd_id INTEGER PRIMARY KEY NOT NULL
335);
336
eb0bc670 337--
338-- Table: liner_notes
339--
340CREATE TABLE liner_notes (
341 liner_id INTEGER PRIMARY KEY NOT NULL,
342 notes varchar(100) NOT NULL
343);
344
eb0bc670 345--
346-- Table: lyric_versions
347--
348CREATE TABLE lyric_versions (
78060df8 349 id INTEGER PRIMARY KEY NOT NULL,
eb0bc670 350 lyric_id integer NOT NULL,
351 text varchar(100) NOT NULL
ebf846e8 352);
353
eb0bc670 354CREATE INDEX lyric_versions_idx_lyric_id ON lyric_versions (lyric_id);
ebf846e8 355
356--
eb0bc670 357-- Table: tags
ebf846e8 358--
eb0bc670 359CREATE TABLE tags (
360 tagid INTEGER PRIMARY KEY NOT NULL,
361 cd integer NOT NULL,
362 tag varchar(100) NOT NULL
363);
364
365CREATE INDEX tags_idx_cd ON tags (cd);
366
367--
368-- Table: cd_to_producer
369--
370CREATE TABLE cd_to_producer (
371 cd integer NOT NULL,
372 producer integer NOT NULL,
373 attribute integer,
374 PRIMARY KEY (cd, producer)
ebf846e8 375);
376
eb0bc670 377CREATE INDEX cd_to_producer_idx_cd ON cd_to_producer (cd);
378
379CREATE INDEX cd_to_producer_idx_producer ON cd_to_producer (producer);
380
381--
382-- Table: images
383--
384CREATE TABLE images (
385 id INTEGER PRIMARY KEY NOT NULL,
386 artwork_id integer NOT NULL,
387 name varchar(100) NOT NULL,
388 data blob
389);
084a2c0a 390
eb0bc670 391CREATE INDEX images_idx_artwork_id ON images (artwork_id);
ebf846e8 392
393--
394-- Table: twokeys
395--
396CREATE TABLE twokeys (
397 artist integer NOT NULL,
398 cd integer NOT NULL,
399 PRIMARY KEY (artist, cd)
400);
401
eb0bc670 402CREATE INDEX twokeys_idx_artist ON twokeys (artist);
ebf846e8 403
404--
eb0bc670 405-- Table: artwork_to_artist
ebf846e8 406--
eb0bc670 407CREATE TABLE artwork_to_artist (
408 artwork_cd_id integer NOT NULL,
409 artist_id integer NOT NULL,
410 PRIMARY KEY (artwork_cd_id, artist_id)
78060df8 411);
412
eb0bc670 413CREATE INDEX artwork_to_artist_idx_artist_id ON artwork_to_artist (artist_id);
414
415CREATE INDEX artwork_to_artist_idx_artwork_cd_id ON artwork_to_artist (artwork_cd_id);
416
417--
418-- Table: fourkeys_to_twokeys
419--
420CREATE TABLE fourkeys_to_twokeys (
421 f_foo integer NOT NULL,
422 f_bar integer NOT NULL,
423 f_hello integer NOT NULL,
424 f_goodbye integer NOT NULL,
425 t_artist integer NOT NULL,
426 t_cd integer NOT NULL,
427 autopilot character NOT NULL,
428 pilot_sequence integer,
429 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
430);
431
432CREATE 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);
433
434CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd ON fourkeys_to_twokeys (t_artist, t_cd);
435
0e80c4ca 436--
084a2c0a 437-- View: year2000cds
0e80c4ca 438--
084a2c0a 439CREATE VIEW year2000cds AS
181b2261 440 SELECT cdid, artist, title, year, genreid, single_track FROM cd WHERE year = "2000"