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