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