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