Test for already fixed RT#59219
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
243e940e 1--
2-- Created by SQL::Translator::Producer::SQLite
e29e2b27 3-- Created on Sun Oct 17 01:51:06 2010
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,
29 clob clob
30);
31
6ec7d1bb 32--
ebf846e8 33-- Table: collection
0009fa49 34--
ebf846e8 35CREATE TABLE collection (
36 collectionid INTEGER PRIMARY KEY NOT NULL,
37 name varchar(100) NOT NULL
0009fa49 38);
39
40--
084a2c0a 41-- Table: encoded
42--
43CREATE TABLE encoded (
44 id INTEGER PRIMARY KEY NOT NULL,
45 encoded varchar(100)
46);
ebf846e8 47
9fcda149 48--
ebf846e8 49-- Table: event
ab8481f5 50--
ebf846e8 51CREATE TABLE event (
ab8481f5 52 id INTEGER PRIMARY KEY NOT NULL,
c5827074 53 starts_at date NOT NULL,
a97fe7e0 54 created_on timestamp NOT NULL,
55 varchar_date varchar(20),
ff8a6e3b 56 varchar_datetime varchar(20),
41308e82 57 skip_inflation datetime,
58 ts_without_tz datetime
ab8481f5 59);
60
61--
823c91a1 62-- Table: file_columns
63--
64CREATE TABLE file_columns (
65 id INTEGER PRIMARY KEY NOT NULL,
66 file varchar(255) NOT NULL
67);
68
69--
ebf846e8 70-- Table: fourkeys
9c2c91ea 71--
ebf846e8 72CREATE TABLE fourkeys (
73 foo integer NOT NULL,
74 bar integer NOT NULL,
75 hello integer NOT NULL,
76 goodbye integer NOT NULL,
ff1234ad 77 sensors character(10) NOT NULL,
78 read_count integer,
ebf846e8 79 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 80);
81
82--
ebf846e8 83-- Table: genre
887ce227 84--
ebf846e8 85CREATE TABLE genre (
87310237 86 genreid INTEGER PRIMARY KEY NOT NULL,
56b73f83 87 name varchar(100) NOT NULL
9c2c91ea 88);
89
eb0bc670 90CREATE UNIQUE INDEX genre_name ON genre (name);
ebf846e8 91
92--
93-- Table: link
94--
95CREATE TABLE link (
96 id INTEGER PRIMARY KEY NOT NULL,
97 url varchar(100),
98 title varchar(100)
99);
100
9c2c91ea 101--
41308e82 102-- Table: money_test
103--
104CREATE TABLE money_test (
105 id INTEGER PRIMARY KEY NOT NULL,
106 amount money
107);
108
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--
4d4dc518 175-- Table: timestamp_primary_key_test
176--
177CREATE TABLE timestamp_primary_key_test (
178 id timestamp NOT NULL DEFAULT current_timestamp,
179 PRIMARY KEY (id)
180);
181
182--
eb0bc670 183-- Table: treelike
78060df8 184--
eb0bc670 185CREATE TABLE treelike (
186 id INTEGER PRIMARY KEY NOT NULL,
187 parent integer,
188 name varchar(100) NOT NULL
189);
190
191CREATE INDEX treelike_idx_parent ON treelike (parent);
192
193--
194-- Table: twokeytreelike
195--
196CREATE TABLE twokeytreelike (
197 id1 integer NOT NULL,
198 id2 integer NOT NULL,
199 parent1 integer NOT NULL,
200 parent2 integer NOT NULL,
201 name varchar(100) NOT NULL,
202 PRIMARY KEY (id1, id2)
203);
204
205CREATE INDEX twokeytreelike_idx_parent1_parent2 ON twokeytreelike (parent1, parent2);
206
207CREATE UNIQUE INDEX tktlnameunique ON twokeytreelike (name);
208
209--
210-- Table: typed_object
211--
212CREATE TABLE typed_object (
213 objectid INTEGER PRIMARY KEY NOT NULL,
214 type varchar(100) NOT NULL,
215 value varchar(100) NOT NULL
216);
217
218--
219-- Table: artist_undirected_map
220--
221CREATE TABLE artist_undirected_map (
222 id1 integer NOT NULL,
223 id2 integer NOT NULL,
224 PRIMARY KEY (id1, id2)
225);
226
227CREATE INDEX artist_undirected_map_idx_id1 ON artist_undirected_map (id1);
228
229CREATE INDEX artist_undirected_map_idx_id2 ON artist_undirected_map (id2);
230
231--
232-- Table: bookmark
233--
234CREATE TABLE bookmark (
235 id INTEGER PRIMARY KEY NOT NULL,
41308e82 236 link integer
eb0bc670 237);
238
239CREATE INDEX bookmark_idx_link ON bookmark (link);
240
241--
242-- Table: books
243--
244CREATE TABLE books (
245 id INTEGER PRIMARY KEY NOT NULL,
246 source varchar(100) NOT NULL,
247 owner integer NOT NULL,
248 title varchar(100) NOT NULL,
249 price integer
250);
251
252CREATE INDEX books_idx_owner ON books (owner);
253
8c7b6644 254CREATE UNIQUE INDEX books_title ON books (title);
255
eb0bc670 256--
68888c09 257-- Table: employee
258--
259CREATE TABLE employee (
260 employee_id INTEGER PRIMARY KEY NOT NULL,
261 position integer NOT NULL,
262 group_id integer,
263 group_id_2 integer,
264 group_id_3 integer,
265 name varchar(100),
266 encoded integer
267);
268
269CREATE INDEX employee_idx_encoded ON employee (encoded);
270
271--
eb0bc670 272-- Table: forceforeign
273--
274CREATE TABLE forceforeign (
275 artist INTEGER PRIMARY KEY NOT NULL,
276 cd integer NOT NULL
277);
278
eb0bc670 279--
280-- Table: self_ref_alias
281--
282CREATE TABLE self_ref_alias (
283 self_ref integer NOT NULL,
284 alias integer NOT NULL,
285 PRIMARY KEY (self_ref, alias)
78060df8 286);
287
eb0bc670 288CREATE INDEX self_ref_alias_idx_alias ON self_ref_alias (alias);
289
290CREATE INDEX self_ref_alias_idx_self_ref ON self_ref_alias (self_ref);
ebf846e8 291
78060df8 292--
ebf846e8 293-- Table: track
78060df8 294--
ebf846e8 295CREATE TABLE track (
296 trackid INTEGER PRIMARY KEY NOT NULL,
297 cd integer NOT NULL,
c1d7087d 298 position int NOT NULL,
ebf846e8 299 title varchar(100) NOT NULL,
abc914bd 300 last_updated_on datetime,
09451687 301 last_updated_at datetime,
c0678cfc 302 small_dt smalldatetime
ebf846e8 303);
304
eb0bc670 305CREATE INDEX track_idx_cd ON track (cd);
084a2c0a 306
eb0bc670 307CREATE UNIQUE INDEX track_cd_position ON track (cd, position);
084a2c0a 308
eb0bc670 309CREATE UNIQUE INDEX track_cd_title ON track (cd, title);
ebf846e8 310
311--
eb0bc670 312-- Table: cd
ebf846e8 313--
eb0bc670 314CREATE TABLE cd (
315 cdid INTEGER PRIMARY KEY NOT NULL,
316 artist integer NOT NULL,
317 title varchar(100) NOT NULL,
318 year varchar(100) NOT NULL,
319 genreid integer,
320 single_track integer
321);
322
323CREATE INDEX cd_idx_artist ON cd (artist);
324
325CREATE INDEX cd_idx_genreid ON cd (genreid);
326
327CREATE INDEX cd_idx_single_track ON cd (single_track);
328
329CREATE UNIQUE INDEX cd_artist_title ON cd (artist, title);
330
331--
332-- Table: collection_object
333--
334CREATE TABLE collection_object (
335 collection integer NOT NULL,
336 object integer NOT NULL,
337 PRIMARY KEY (collection, object)
338);
339
340CREATE INDEX collection_object_idx_collection ON collection_object (collection);
341
342CREATE INDEX collection_object_idx_object ON collection_object (object);
343
344--
345-- Table: lyrics
346--
347CREATE TABLE lyrics (
348 lyric_id INTEGER PRIMARY KEY NOT NULL,
349 track_id integer NOT NULL
350);
351
352CREATE INDEX lyrics_idx_track_id ON lyrics (track_id);
353
354--
355-- Table: cd_artwork
356--
357CREATE TABLE cd_artwork (
358 cd_id INTEGER PRIMARY KEY NOT NULL
359);
360
eb0bc670 361--
362-- Table: liner_notes
363--
364CREATE TABLE liner_notes (
365 liner_id INTEGER PRIMARY KEY NOT NULL,
366 notes varchar(100) NOT NULL
367);
368
eb0bc670 369--
370-- Table: lyric_versions
371--
372CREATE TABLE lyric_versions (
78060df8 373 id INTEGER PRIMARY KEY NOT NULL,
eb0bc670 374 lyric_id integer NOT NULL,
375 text varchar(100) NOT NULL
ebf846e8 376);
377
eb0bc670 378CREATE INDEX lyric_versions_idx_lyric_id ON lyric_versions (lyric_id);
ebf846e8 379
380--
eb0bc670 381-- Table: tags
ebf846e8 382--
eb0bc670 383CREATE TABLE tags (
384 tagid INTEGER PRIMARY KEY NOT NULL,
385 cd integer NOT NULL,
386 tag varchar(100) NOT NULL
387);
388
389CREATE INDEX tags_idx_cd ON tags (cd);
390
84f7e8a1 391CREATE UNIQUE INDEX tagid_cd ON tags (tagid, cd);
392
393CREATE UNIQUE INDEX tagid_cd_tag ON tags (tagid, cd, tag);
394
395CREATE UNIQUE INDEX tags_tagid_tag ON tags (tagid, tag);
396
397CREATE UNIQUE INDEX tags_tagid_tag_cd ON tags (tagid, tag, cd);
398
eb0bc670 399--
400-- Table: cd_to_producer
401--
402CREATE TABLE cd_to_producer (
403 cd integer NOT NULL,
404 producer integer NOT NULL,
405 attribute integer,
406 PRIMARY KEY (cd, producer)
ebf846e8 407);
408
eb0bc670 409CREATE INDEX cd_to_producer_idx_cd ON cd_to_producer (cd);
410
411CREATE INDEX cd_to_producer_idx_producer ON cd_to_producer (producer);
412
413--
414-- Table: images
415--
416CREATE TABLE images (
417 id INTEGER PRIMARY KEY NOT NULL,
418 artwork_id integer NOT NULL,
419 name varchar(100) NOT NULL,
420 data blob
421);
084a2c0a 422
eb0bc670 423CREATE INDEX images_idx_artwork_id ON images (artwork_id);
ebf846e8 424
425--
426-- Table: twokeys
427--
428CREATE TABLE twokeys (
429 artist integer NOT NULL,
430 cd integer NOT NULL,
431 PRIMARY KEY (artist, cd)
432);
433
eb0bc670 434CREATE INDEX twokeys_idx_artist ON twokeys (artist);
ebf846e8 435
436--
eb0bc670 437-- Table: artwork_to_artist
ebf846e8 438--
eb0bc670 439CREATE TABLE artwork_to_artist (
440 artwork_cd_id integer NOT NULL,
441 artist_id integer NOT NULL,
442 PRIMARY KEY (artwork_cd_id, artist_id)
78060df8 443);
444
eb0bc670 445CREATE INDEX artwork_to_artist_idx_artist_id ON artwork_to_artist (artist_id);
446
447CREATE INDEX artwork_to_artist_idx_artwork_cd_id ON artwork_to_artist (artwork_cd_id);
448
449--
450-- Table: fourkeys_to_twokeys
451--
452CREATE TABLE fourkeys_to_twokeys (
453 f_foo integer NOT NULL,
454 f_bar integer NOT NULL,
455 f_hello integer NOT NULL,
456 f_goodbye integer NOT NULL,
457 t_artist integer NOT NULL,
458 t_cd integer NOT NULL,
459 autopilot character NOT NULL,
460 pilot_sequence integer,
461 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
462);
463
464CREATE 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);
465
466CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd ON fourkeys_to_twokeys (t_artist, t_cd);
467
0e80c4ca 468--
084a2c0a 469-- View: year2000cds
0e80c4ca 470--
084a2c0a 471CREATE VIEW year2000cds AS
8c7b6644 472 SELECT cdid, artist, title, year, genreid, single_track FROM cd WHERE year = "2000";