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