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