Bump author SQLT dependency for early developer testing
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
0009fa49 1--
2-- Created by SQL::Translator::Producer::SQLite
eb0bc670 3-- Created on Sat Jun 27 14:02:39 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--
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),
a0dd8679 66 skip_inflation datetime
ab8481f5 67);
68
69--
4740bdb7 70-- Table: file_columns
71--
72CREATE TABLE file_columns (
73 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 74 file varchar(255) NOT NULL
4740bdb7 75);
76
77--
ebf846e8 78-- Table: fourkeys
9c2c91ea 79--
ebf846e8 80CREATE TABLE fourkeys (
81 foo integer NOT NULL,
82 bar integer NOT NULL,
83 hello integer NOT NULL,
84 goodbye integer NOT NULL,
ff1234ad 85 sensors character(10) NOT NULL,
86 read_count integer,
ebf846e8 87 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 88);
89
90--
ebf846e8 91-- Table: genre
887ce227 92--
ebf846e8 93CREATE TABLE genre (
87310237 94 genreid INTEGER PRIMARY KEY NOT NULL,
56b73f83 95 name varchar(100) NOT NULL
9c2c91ea 96);
97
eb0bc670 98CREATE UNIQUE INDEX genre_name ON genre (name);
ebf846e8 99
100--
101-- Table: link
102--
103CREATE TABLE link (
104 id INTEGER PRIMARY KEY NOT NULL,
105 url varchar(100),
106 title varchar(100)
107);
108
9c2c91ea 109--
89034887 110-- Table: noprimarykey
111--
112CREATE TABLE noprimarykey (
113 foo integer NOT NULL,
114 bar integer NOT NULL,
115 baz integer NOT NULL
116);
117
eb0bc670 118CREATE UNIQUE INDEX foo_bar ON noprimarykey (foo, bar);
ebf846e8 119
89034887 120--
ebf846e8 121-- Table: onekey
9c2c91ea 122--
ebf846e8 123CREATE TABLE onekey (
124 id INTEGER PRIMARY KEY NOT NULL,
125 artist integer NOT NULL,
126 cd integer NOT NULL
9c2c91ea 127);
128
129--
ebf846e8 130-- Table: owners
9c2c91ea 131--
ebf846e8 132CREATE TABLE owners (
bed3a173 133 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 134 name varchar(100) NOT NULL
9c2c91ea 135);
136
137--
138-- Table: producer
139--
140CREATE TABLE producer (
141 producerid INTEGER PRIMARY KEY NOT NULL,
8fcf21b3 142 name varchar(100) NOT NULL
887ce227 143);
144
eb0bc670 145CREATE UNIQUE INDEX prod_name ON producer (name);
ebf846e8 146
9fcda149 147--
ebf846e8 148-- Table: self_ref
9fcda149 149--
ebf846e8 150CREATE TABLE self_ref (
8fcf21b3 151 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 152 name varchar(100) NOT NULL
9fcda149 153);
154
78060df8 155--
ebf846e8 156-- Table: sequence_test
78060df8 157--
ebf846e8 158CREATE TABLE sequence_test (
159 pkid1 integer NOT NULL,
160 pkid2 integer NOT NULL,
161 nonpkid integer NOT NULL,
162 name varchar(100),
163 PRIMARY KEY (pkid1, pkid2)
78060df8 164);
165
166--
ebf846e8 167-- Table: serialized
78060df8 168--
ebf846e8 169CREATE TABLE serialized (
170 id INTEGER PRIMARY KEY NOT NULL,
171 serialized text NOT NULL
78060df8 172);
173
174--
eb0bc670 175-- Table: treelike
78060df8 176--
eb0bc670 177CREATE TABLE treelike (
178 id INTEGER PRIMARY KEY NOT NULL,
179 parent integer,
180 name varchar(100) NOT NULL
181);
182
183CREATE INDEX treelike_idx_parent ON treelike (parent);
184
185--
186-- Table: twokeytreelike
187--
188CREATE TABLE twokeytreelike (
189 id1 integer NOT NULL,
190 id2 integer NOT NULL,
191 parent1 integer NOT NULL,
192 parent2 integer NOT NULL,
193 name varchar(100) NOT NULL,
194 PRIMARY KEY (id1, id2)
195);
196
197CREATE INDEX twokeytreelike_idx_parent1_parent2 ON twokeytreelike (parent1, parent2);
198
199CREATE UNIQUE INDEX tktlnameunique ON twokeytreelike (name);
200
201--
202-- Table: typed_object
203--
204CREATE TABLE typed_object (
205 objectid INTEGER PRIMARY KEY NOT NULL,
206 type varchar(100) NOT NULL,
207 value varchar(100) NOT NULL
208);
209
210--
211-- Table: artist_undirected_map
212--
213CREATE TABLE artist_undirected_map (
214 id1 integer NOT NULL,
215 id2 integer NOT NULL,
216 PRIMARY KEY (id1, id2)
217);
218
219CREATE INDEX artist_undirected_map_idx_id1 ON artist_undirected_map (id1);
220
221CREATE INDEX artist_undirected_map_idx_id2 ON artist_undirected_map (id2);
222
223--
224-- Table: bookmark
225--
226CREATE TABLE bookmark (
227 id INTEGER PRIMARY KEY NOT NULL,
228 link integer NOT NULL
229);
230
231CREATE INDEX bookmark_idx_link ON bookmark (link);
232
233--
234-- Table: books
235--
236CREATE TABLE books (
237 id INTEGER PRIMARY KEY NOT NULL,
238 source varchar(100) NOT NULL,
239 owner integer NOT NULL,
240 title varchar(100) NOT NULL,
241 price integer
242);
243
244CREATE INDEX books_idx_owner ON books (owner);
245
246--
247-- Table: forceforeign
248--
249CREATE TABLE forceforeign (
250 artist INTEGER PRIMARY KEY NOT NULL,
251 cd integer NOT NULL
252);
253
254CREATE INDEX forceforeign_idx_artist ON forceforeign (artist);
255
256--
257-- Table: self_ref_alias
258--
259CREATE TABLE self_ref_alias (
260 self_ref integer NOT NULL,
261 alias integer NOT NULL,
262 PRIMARY KEY (self_ref, alias)
78060df8 263);
264
eb0bc670 265CREATE INDEX self_ref_alias_idx_alias ON self_ref_alias (alias);
266
267CREATE INDEX self_ref_alias_idx_self_ref ON self_ref_alias (self_ref);
ebf846e8 268
78060df8 269--
ebf846e8 270-- Table: track
78060df8 271--
ebf846e8 272CREATE TABLE track (
273 trackid INTEGER PRIMARY KEY NOT NULL,
274 cd integer NOT NULL,
275 position integer NOT NULL,
276 title varchar(100) NOT NULL,
abc914bd 277 last_updated_on datetime,
278 last_updated_at datetime
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
337CREATE INDEX cd_artwork_idx_cd_id ON cd_artwork (cd_id);
338
339--
340-- Table: liner_notes
341--
342CREATE TABLE liner_notes (
343 liner_id INTEGER PRIMARY KEY NOT NULL,
344 notes varchar(100) NOT NULL
345);
346
347CREATE INDEX liner_notes_idx_liner_id ON liner_notes (liner_id);
348
349--
350-- Table: lyric_versions
351--
352CREATE TABLE lyric_versions (
78060df8 353 id INTEGER PRIMARY KEY NOT NULL,
eb0bc670 354 lyric_id integer NOT NULL,
355 text varchar(100) NOT NULL
ebf846e8 356);
357
eb0bc670 358CREATE INDEX lyric_versions_idx_lyric_id ON lyric_versions (lyric_id);
ebf846e8 359
360--
eb0bc670 361-- Table: tags
ebf846e8 362--
eb0bc670 363CREATE TABLE tags (
364 tagid INTEGER PRIMARY KEY NOT NULL,
365 cd integer NOT NULL,
366 tag varchar(100) NOT NULL
367);
368
369CREATE INDEX tags_idx_cd ON tags (cd);
370
371--
372-- Table: cd_to_producer
373--
374CREATE TABLE cd_to_producer (
375 cd integer NOT NULL,
376 producer integer NOT NULL,
377 attribute integer,
378 PRIMARY KEY (cd, producer)
ebf846e8 379);
380
eb0bc670 381CREATE INDEX cd_to_producer_idx_cd ON cd_to_producer (cd);
382
383CREATE INDEX cd_to_producer_idx_producer ON cd_to_producer (producer);
384
385--
386-- Table: images
387--
388CREATE TABLE images (
389 id INTEGER PRIMARY KEY NOT NULL,
390 artwork_id integer NOT NULL,
391 name varchar(100) NOT NULL,
392 data blob
393);
084a2c0a 394
eb0bc670 395CREATE INDEX images_idx_artwork_id ON images (artwork_id);
ebf846e8 396
397--
398-- Table: twokeys
399--
400CREATE TABLE twokeys (
401 artist integer NOT NULL,
402 cd integer NOT NULL,
403 PRIMARY KEY (artist, cd)
404);
405
eb0bc670 406CREATE INDEX twokeys_idx_artist ON twokeys (artist);
ebf846e8 407
408--
eb0bc670 409-- Table: artwork_to_artist
ebf846e8 410--
eb0bc670 411CREATE TABLE artwork_to_artist (
412 artwork_cd_id integer NOT NULL,
413 artist_id integer NOT NULL,
414 PRIMARY KEY (artwork_cd_id, artist_id)
78060df8 415);
416
eb0bc670 417CREATE INDEX artwork_to_artist_idx_artist_id ON artwork_to_artist (artist_id);
418
419CREATE INDEX artwork_to_artist_idx_artwork_cd_id ON artwork_to_artist (artwork_cd_id);
420
421--
422-- Table: fourkeys_to_twokeys
423--
424CREATE TABLE fourkeys_to_twokeys (
425 f_foo integer NOT NULL,
426 f_bar integer NOT NULL,
427 f_hello integer NOT NULL,
428 f_goodbye integer NOT NULL,
429 t_artist integer NOT NULL,
430 t_cd integer NOT NULL,
431 autopilot character NOT NULL,
432 pilot_sequence integer,
433 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
434);
435
436CREATE 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);
437
438CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd ON fourkeys_to_twokeys (t_artist, t_cd);
439
0e80c4ca 440--
084a2c0a 441-- View: year2000cds
0e80c4ca 442--
084a2c0a 443CREATE VIEW year2000cds AS
444 SELECT cdid, artist, title FROM cd WHERE year ='2000';
78060df8 445
0009fa49 446COMMIT;