revert previous revision
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
0009fa49 1--
2-- Created by SQL::Translator::Producer::SQLite
6ffb5be5 3-- Created on Sat Jan 24 19:42:15 2009
0009fa49 4--
5BEGIN TRANSACTION;
6
0009fa49 7
8--
9-- Table: artist
10--
11CREATE TABLE artist (
12 artistid INTEGER PRIMARY KEY NOT NULL,
39da2a2b 13 name varchar(100),
a0dd8679 14 rank integer NOT NULL DEFAULT '13',
15 charfield char(10)
0009fa49 16);
17
ebf846e8 18
0009fa49 19--
ebf846e8 20-- Table: artist_undirected_map
9c2c91ea 21--
ebf846e8 22CREATE TABLE artist_undirected_map (
9c2c91ea 23 id1 integer NOT NULL,
24 id2 integer NOT NULL,
9c2c91ea 25 PRIMARY KEY (id1, id2)
26);
27
ebf846e8 28CREATE INDEX artist_undirected_map_idx_id1_ ON artist_undirected_map (id1);
29CREATE INDEX artist_undirected_map_idx_id2_ ON artist_undirected_map (id2);
30
9c2c91ea 31--
4f6386b0 32-- Table: cd_artwork
33--
34CREATE TABLE cd_artwork (
35 cd_id INTEGER PRIMARY KEY NOT NULL
36);
37
38CREATE INDEX cd_artwork_idx_cd_id_cd_artwor ON cd_artwork (cd_id);
39
40--
6ffb5be5 41-- Table: artwork_to_artist
42--
43CREATE TABLE artwork_to_artist (
44 artwork_cd_id integer NOT NULL,
45 artist_id integer NOT NULL,
46 PRIMARY KEY (artwork_cd_id, artist_id)
47);
48
49CREATE INDEX artwork_to_artist_idx_artist_id_artwork_to_arti ON artwork_to_artist (artist_id);
50CREATE INDEX artwork_to_artist_idx_artwork_cd_id_artwork_to_ ON artwork_to_artist (artwork_cd_id);
51
52--
6ec7d1bb 53-- Table: bindtype_test
54--
55CREATE TABLE bindtype_test (
56 id INTEGER PRIMARY KEY NOT NULL,
57 bytea blob,
58 blob blob,
59 clob clob
60);
61
62
63--
ebf846e8 64-- Table: bookmark
3bd6e3e0 65--
ebf846e8 66CREATE TABLE bookmark (
67 id INTEGER PRIMARY KEY NOT NULL,
68 link integer NOT NULL
3bd6e3e0 69);
70
ebf846e8 71CREATE INDEX bookmark_idx_link_bookmark ON bookmark (link);
72
3bd6e3e0 73--
ebf846e8 74-- Table: books
0009fa49 75--
ebf846e8 76CREATE TABLE books (
77 id INTEGER PRIMARY KEY NOT NULL,
78 source varchar(100) NOT NULL,
79 owner integer NOT NULL,
cda5e082 80 title varchar(100) NOT NULL,
81 price integer
0009fa49 82);
83
ebf846e8 84
0009fa49 85--
0009fa49 86-- Table: cd
87--
88CREATE TABLE cd (
89 cdid INTEGER PRIMARY KEY NOT NULL,
90 artist integer NOT NULL,
8fcf21b3 91 title varchar(100) NOT NULL,
370f2ba2 92 year varchar(100) NOT NULL,
a1cb5921 93 genreid integer,
94 single_track integer
370f2ba2 95);
96
ebf846e8 97CREATE INDEX cd_idx_artist_cd ON cd (artist);
98CREATE INDEX cd_idx_genreid_cd ON cd (genreid);
a1cb5921 99CREATE INDEX cd_idx_single_track_cd ON cd (single_track);
ebf846e8 100CREATE UNIQUE INDEX cd_artist_title_cd ON cd (artist, title);
101
370f2ba2 102--
ebf846e8 103-- Table: cd_to_producer
370f2ba2 104--
ebf846e8 105CREATE TABLE cd_to_producer (
106 cd integer NOT NULL,
107 producer integer NOT NULL,
108 PRIMARY KEY (cd, producer)
0009fa49 109);
110
ebf846e8 111CREATE INDEX cd_to_producer_idx_cd_cd_to_pr ON cd_to_producer (cd);
112CREATE INDEX cd_to_producer_idx_producer_cd ON cd_to_producer (producer);
113
0009fa49 114--
ebf846e8 115-- Table: collection
0009fa49 116--
ebf846e8 117CREATE TABLE collection (
118 collectionid INTEGER PRIMARY KEY NOT NULL,
119 name varchar(100) NOT NULL
0009fa49 120);
121
ebf846e8 122
0009fa49 123--
ebf846e8 124-- Table: collection_object
0009fa49 125--
ebf846e8 126CREATE TABLE collection_object (
127 collection integer NOT NULL,
128 object integer NOT NULL,
129 PRIMARY KEY (collection, object)
0009fa49 130);
131
ebf846e8 132CREATE INDEX collection_object_idx_collection_collection_obj ON collection_object (collection);
133CREATE INDEX collection_object_idx_object_c ON collection_object (object);
134
0009fa49 135--
ebf846e8 136-- Table: employee
887ce227 137--
ebf846e8 138CREATE TABLE employee (
139 employee_id INTEGER PRIMARY KEY NOT NULL,
140 position integer NOT NULL,
141 group_id integer,
142 group_id_2 integer,
143 name varchar(100)
887ce227 144);
145
ebf846e8 146
9fcda149 147--
ebf846e8 148-- Table: event
ab8481f5 149--
ebf846e8 150CREATE TABLE event (
ab8481f5 151 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 152 starts_at datetime NOT NULL,
a97fe7e0 153 created_on timestamp NOT NULL,
154 varchar_date varchar(20),
ff8a6e3b 155 varchar_datetime varchar(20),
a0dd8679 156 skip_inflation datetime
ab8481f5 157);
158
ebf846e8 159
ab8481f5 160--
4740bdb7 161-- Table: file_columns
162--
163CREATE TABLE file_columns (
164 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 165 file varchar(255) NOT NULL
4740bdb7 166);
167
ebf846e8 168
4740bdb7 169--
ebf846e8 170-- Table: forceforeign
77211009 171--
ebf846e8 172CREATE TABLE forceforeign (
173 artist INTEGER PRIMARY KEY NOT NULL,
174 cd integer NOT NULL
77211009 175);
176
ebf846e8 177CREATE INDEX forceforeign_idx_artist_forcef ON forceforeign (artist);
178
77211009 179--
ebf846e8 180-- Table: fourkeys
9c2c91ea 181--
ebf846e8 182CREATE TABLE fourkeys (
183 foo integer NOT NULL,
184 bar integer NOT NULL,
185 hello integer NOT NULL,
186 goodbye integer NOT NULL,
187 sensors character NOT NULL,
188 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 189);
190
ebf846e8 191
0009fa49 192--
ebf846e8 193-- Table: fourkeys_to_twokeys
0009fa49 194--
ebf846e8 195CREATE TABLE fourkeys_to_twokeys (
196 f_foo integer NOT NULL,
197 f_bar integer NOT NULL,
198 f_hello integer NOT NULL,
199 f_goodbye integer NOT NULL,
200 t_artist integer NOT NULL,
201 t_cd integer NOT NULL,
202 autopilot character NOT NULL,
203 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
0009fa49 204);
205
ebf846e8 206CREATE 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);
207CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd_fourkeys_to ON fourkeys_to_twokeys (t_artist, t_cd);
208
887ce227 209--
ebf846e8 210-- Table: genre
887ce227 211--
ebf846e8 212CREATE TABLE genre (
87310237 213 genreid INTEGER PRIMARY KEY NOT NULL,
214 name varchar(100) NOT NULL
9c2c91ea 215);
216
87310237 217CREATE UNIQUE INDEX genre_name_genre ON genre (name);
ebf846e8 218
219--
4f6386b0 220-- Table: images
221--
222CREATE TABLE images (
223 id INTEGER PRIMARY KEY NOT NULL,
224 artwork_id integer NOT NULL,
225 name varchar(100) NOT NULL,
226 data blob
227);
228
229CREATE INDEX images_idx_artwork_id_images ON images (artwork_id);
230
231--
ebf846e8 232-- Table: liner_notes
233--
234CREATE TABLE liner_notes (
235 liner_id INTEGER PRIMARY KEY NOT NULL,
236 notes varchar(100) NOT NULL
237);
238
6bf6ba2f 239CREATE INDEX liner_notes_idx_liner_id_liner ON liner_notes (liner_id);
ebf846e8 240
241--
242-- Table: link
243--
244CREATE TABLE link (
245 id INTEGER PRIMARY KEY NOT NULL,
246 url varchar(100),
247 title varchar(100)
248);
249
250
9c2c91ea 251--
4f6386b0 252-- Table: lyric_versions
253--
254CREATE TABLE lyric_versions (
255 id INTEGER PRIMARY KEY NOT NULL,
256 lyric_id integer NOT NULL,
257 text varchar(100) NOT NULL
258);
259
260CREATE INDEX lyric_versions_idx_lyric_id_ly ON lyric_versions (lyric_id);
261
262--
263-- Table: lyrics
264--
265CREATE TABLE lyrics (
266 lyric_id INTEGER PRIMARY KEY NOT NULL,
267 track_id integer NOT NULL
268);
269
270CREATE INDEX lyrics_idx_track_id_lyrics ON lyrics (track_id);
271
272--
89034887 273-- Table: noprimarykey
274--
275CREATE TABLE noprimarykey (
276 foo integer NOT NULL,
277 bar integer NOT NULL,
278 baz integer NOT NULL
279);
280
ebf846e8 281CREATE UNIQUE INDEX foo_bar_noprimarykey ON noprimarykey (foo, bar);
282
89034887 283--
ebf846e8 284-- Table: onekey
9c2c91ea 285--
ebf846e8 286CREATE TABLE onekey (
287 id INTEGER PRIMARY KEY NOT NULL,
288 artist integer NOT NULL,
289 cd integer NOT NULL
9c2c91ea 290);
291
ebf846e8 292
9c2c91ea 293--
ebf846e8 294-- Table: owners
9c2c91ea 295--
ebf846e8 296CREATE TABLE owners (
297 ownerid INTEGER PRIMARY KEY NOT NULL,
298 name varchar(100) NOT NULL
9c2c91ea 299);
300
ebf846e8 301
9c2c91ea 302--
303-- Table: producer
304--
305CREATE TABLE producer (
306 producerid INTEGER PRIMARY KEY NOT NULL,
8fcf21b3 307 name varchar(100) NOT NULL
887ce227 308);
309
ebf846e8 310CREATE UNIQUE INDEX prod_name_producer ON producer (name);
311
9fcda149 312--
ebf846e8 313-- Table: self_ref
9fcda149 314--
ebf846e8 315CREATE TABLE self_ref (
8fcf21b3 316 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 317 name varchar(100) NOT NULL
9fcda149 318);
319
ebf846e8 320
78060df8 321--
ebf846e8 322-- Table: self_ref_alias
78060df8 323--
ebf846e8 324CREATE TABLE self_ref_alias (
325 self_ref integer NOT NULL,
326 alias integer NOT NULL,
327 PRIMARY KEY (self_ref, alias)
78060df8 328);
329
ebf846e8 330CREATE INDEX self_ref_alias_idx_alias_self_ ON self_ref_alias (alias);
331CREATE INDEX self_ref_alias_idx_self_ref_se ON self_ref_alias (self_ref);
332
78060df8 333--
ebf846e8 334-- Table: sequence_test
78060df8 335--
ebf846e8 336CREATE TABLE sequence_test (
337 pkid1 integer NOT NULL,
338 pkid2 integer NOT NULL,
339 nonpkid integer NOT NULL,
340 name varchar(100),
341 PRIMARY KEY (pkid1, pkid2)
78060df8 342);
343
ebf846e8 344
78060df8 345--
ebf846e8 346-- Table: serialized
78060df8 347--
ebf846e8 348CREATE TABLE serialized (
349 id INTEGER PRIMARY KEY NOT NULL,
350 serialized text NOT NULL
78060df8 351);
352
ebf846e8 353
78060df8 354--
ebf846e8 355-- Table: tags
78060df8 356--
ebf846e8 357CREATE TABLE tags (
358 tagid INTEGER PRIMARY KEY NOT NULL,
359 cd integer NOT NULL,
360 tag varchar(100) NOT NULL
78060df8 361);
362
ebf846e8 363CREATE INDEX tags_idx_cd_tags ON tags (cd);
364
78060df8 365--
ebf846e8 366-- Table: track
78060df8 367--
ebf846e8 368CREATE TABLE track (
369 trackid INTEGER PRIMARY KEY NOT NULL,
370 cd integer NOT NULL,
371 position integer NOT NULL,
372 title varchar(100) NOT NULL,
373 last_updated_on datetime
374);
375
376CREATE INDEX track_idx_cd_track ON track (cd);
377CREATE UNIQUE INDEX track_cd_position_track ON track (cd, position);
378CREATE UNIQUE INDEX track_cd_title_track ON track (cd, title);
379
380--
381-- Table: treelike
382--
383CREATE TABLE treelike (
78060df8 384 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 385 parent integer,
386 name varchar(100) NOT NULL
387);
388
389CREATE INDEX treelike_idx_parent_treelike ON treelike (parent);
390
391--
392-- Table: twokeytreelike
393--
394CREATE TABLE twokeytreelike (
395 id1 integer NOT NULL,
396 id2 integer NOT NULL,
397 parent1 integer NOT NULL,
398 parent2 integer NOT NULL,
399 name varchar(100) NOT NULL,
400 PRIMARY KEY (id1, id2)
401);
402
403CREATE INDEX twokeytreelike_idx_parent1_parent2_twokeytre ON twokeytreelike (parent1, parent2);
404CREATE UNIQUE INDEX tktlnameunique_twokeytreelike ON twokeytreelike (name);
405
406--
407-- Table: twokeys
408--
409CREATE TABLE twokeys (
410 artist integer NOT NULL,
411 cd integer NOT NULL,
412 PRIMARY KEY (artist, cd)
413);
414
415CREATE INDEX twokeys_idx_artist_twokeys ON twokeys (artist);
416
417--
418-- Table: typed_object
419--
420CREATE TABLE typed_object (
421 objectid INTEGER PRIMARY KEY NOT NULL,
422 type varchar(100) NOT NULL,
423 value varchar(100) NOT NULL
78060df8 424);
425
0e80c4ca 426--
427-- Table: encoded
428--
429CREATE TABLE encoded (
430 id INTEGER PRIMARY KEY NOT NULL,
431 encoded varchar(100) NOT NULL
432);
78060df8 433
0009fa49 434COMMIT;