SQLT behaves sanely in scalar context, no need for stupid version detections (ribasus...
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
0009fa49 1--
2-- Created by SQL::Translator::Producer::SQLite
cda5e082 3-- Created on Sun Nov 2 15:27:04 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),
14 rank integer NOT NULL DEFAULT '13'
0009fa49 15);
16
ebf846e8 17
0009fa49 18--
ebf846e8 19-- Table: artist_undirected_map
9c2c91ea 20--
ebf846e8 21CREATE TABLE artist_undirected_map (
9c2c91ea 22 id1 integer NOT NULL,
23 id2 integer NOT NULL,
9c2c91ea 24 PRIMARY KEY (id1, id2)
25);
26
ebf846e8 27CREATE INDEX artist_undirected_map_idx_id1_ ON artist_undirected_map (id1);
28CREATE INDEX artist_undirected_map_idx_id2_ ON artist_undirected_map (id2);
29
9c2c91ea 30--
ebf846e8 31-- Table: bookmark
3bd6e3e0 32--
ebf846e8 33CREATE TABLE bookmark (
34 id INTEGER PRIMARY KEY NOT NULL,
35 link integer NOT NULL
3bd6e3e0 36);
37
ebf846e8 38CREATE INDEX bookmark_idx_link_bookmark ON bookmark (link);
39
3bd6e3e0 40--
ebf846e8 41-- Table: books
0009fa49 42--
ebf846e8 43CREATE TABLE books (
44 id INTEGER PRIMARY KEY NOT NULL,
45 source varchar(100) NOT NULL,
46 owner integer NOT NULL,
cda5e082 47 title varchar(100) NOT NULL,
48 price integer
0009fa49 49);
50
ebf846e8 51
0009fa49 52--
0009fa49 53-- Table: cd
54--
55CREATE TABLE cd (
56 cdid INTEGER PRIMARY KEY NOT NULL,
57 artist integer NOT NULL,
8fcf21b3 58 title varchar(100) NOT NULL,
370f2ba2 59 year varchar(100) NOT NULL,
60 genreid integer
61);
62
ebf846e8 63CREATE INDEX cd_idx_artist_cd ON cd (artist);
64CREATE INDEX cd_idx_genreid_cd ON cd (genreid);
65CREATE UNIQUE INDEX cd_artist_title_cd ON cd (artist, title);
66
370f2ba2 67--
ebf846e8 68-- Table: cd_to_producer
370f2ba2 69--
ebf846e8 70CREATE TABLE cd_to_producer (
71 cd integer NOT NULL,
72 producer integer NOT NULL,
73 PRIMARY KEY (cd, producer)
0009fa49 74);
75
ebf846e8 76CREATE INDEX cd_to_producer_idx_cd_cd_to_pr ON cd_to_producer (cd);
77CREATE INDEX cd_to_producer_idx_producer_cd ON cd_to_producer (producer);
78
0009fa49 79--
ebf846e8 80-- Table: collection
0009fa49 81--
ebf846e8 82CREATE TABLE collection (
83 collectionid INTEGER PRIMARY KEY NOT NULL,
84 name varchar(100) NOT NULL
0009fa49 85);
86
ebf846e8 87
0009fa49 88--
ebf846e8 89-- Table: collection_object
0009fa49 90--
ebf846e8 91CREATE TABLE collection_object (
92 collection integer NOT NULL,
93 object integer NOT NULL,
94 PRIMARY KEY (collection, object)
0009fa49 95);
96
ebf846e8 97CREATE INDEX collection_object_idx_collection_collection_obj ON collection_object (collection);
98CREATE INDEX collection_object_idx_object_c ON collection_object (object);
99
0009fa49 100--
ebf846e8 101-- Table: employee
887ce227 102--
ebf846e8 103CREATE TABLE employee (
104 employee_id INTEGER PRIMARY KEY NOT NULL,
105 position integer NOT NULL,
106 group_id integer,
107 group_id_2 integer,
108 name varchar(100)
887ce227 109);
110
ebf846e8 111
9fcda149 112--
ebf846e8 113-- Table: event
ab8481f5 114--
ebf846e8 115CREATE TABLE event (
ab8481f5 116 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 117 starts_at datetime NOT NULL,
a97fe7e0 118 created_on timestamp NOT NULL,
119 varchar_date varchar(20),
ff8a6e3b 120 varchar_datetime varchar(20),
121 skip_inflation datetime(20)
ab8481f5 122);
123
ebf846e8 124
ab8481f5 125--
4740bdb7 126-- Table: file_columns
127--
128CREATE TABLE file_columns (
129 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 130 file varchar(255) NOT NULL
4740bdb7 131);
132
ebf846e8 133
4740bdb7 134--
ebf846e8 135-- Table: forceforeign
77211009 136--
ebf846e8 137CREATE TABLE forceforeign (
138 artist INTEGER PRIMARY KEY NOT NULL,
139 cd integer NOT NULL
77211009 140);
141
ebf846e8 142CREATE INDEX forceforeign_idx_artist_forcef ON forceforeign (artist);
143
77211009 144--
ebf846e8 145-- Table: fourkeys
9c2c91ea 146--
ebf846e8 147CREATE TABLE fourkeys (
148 foo integer NOT NULL,
149 bar integer NOT NULL,
150 hello integer NOT NULL,
151 goodbye integer NOT NULL,
152 sensors character NOT NULL,
153 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 154);
155
ebf846e8 156
0009fa49 157--
ebf846e8 158-- Table: fourkeys_to_twokeys
0009fa49 159--
ebf846e8 160CREATE TABLE fourkeys_to_twokeys (
161 f_foo integer NOT NULL,
162 f_bar integer NOT NULL,
163 f_hello integer NOT NULL,
164 f_goodbye integer NOT NULL,
165 t_artist integer NOT NULL,
166 t_cd integer NOT NULL,
167 autopilot character NOT NULL,
168 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
0009fa49 169);
170
ebf846e8 171CREATE 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);
172CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd_fourkeys_to ON fourkeys_to_twokeys (t_artist, t_cd);
173
887ce227 174--
ebf846e8 175-- Table: genre
887ce227 176--
ebf846e8 177CREATE TABLE genre (
87310237 178 genreid INTEGER PRIMARY KEY NOT NULL,
179 name varchar(100) NOT NULL
9c2c91ea 180);
181
87310237 182CREATE UNIQUE INDEX genre_name_genre ON genre (name);
ebf846e8 183
184--
185-- Table: liner_notes
186--
187CREATE TABLE liner_notes (
188 liner_id INTEGER PRIMARY KEY NOT NULL,
189 notes varchar(100) NOT NULL
190);
191
192
193--
194-- Table: link
195--
196CREATE TABLE link (
197 id INTEGER PRIMARY KEY NOT NULL,
198 url varchar(100),
199 title varchar(100)
200);
201
202
9c2c91ea 203--
89034887 204-- Table: noprimarykey
205--
206CREATE TABLE noprimarykey (
207 foo integer NOT NULL,
208 bar integer NOT NULL,
209 baz integer NOT NULL
210);
211
ebf846e8 212CREATE UNIQUE INDEX foo_bar_noprimarykey ON noprimarykey (foo, bar);
213
89034887 214--
ebf846e8 215-- Table: onekey
9c2c91ea 216--
ebf846e8 217CREATE TABLE onekey (
218 id INTEGER PRIMARY KEY NOT NULL,
219 artist integer NOT NULL,
220 cd integer NOT NULL
9c2c91ea 221);
222
ebf846e8 223
9c2c91ea 224--
ebf846e8 225-- Table: owners
9c2c91ea 226--
ebf846e8 227CREATE TABLE owners (
228 ownerid INTEGER PRIMARY KEY NOT NULL,
229 name varchar(100) NOT NULL
9c2c91ea 230);
231
ebf846e8 232
9c2c91ea 233--
234-- Table: producer
235--
236CREATE TABLE producer (
237 producerid INTEGER PRIMARY KEY NOT NULL,
8fcf21b3 238 name varchar(100) NOT NULL
887ce227 239);
240
ebf846e8 241CREATE UNIQUE INDEX prod_name_producer ON producer (name);
242
9fcda149 243--
ebf846e8 244-- Table: self_ref
9fcda149 245--
ebf846e8 246CREATE TABLE self_ref (
8fcf21b3 247 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 248 name varchar(100) NOT NULL
9fcda149 249);
250
ebf846e8 251
78060df8 252--
ebf846e8 253-- Table: self_ref_alias
78060df8 254--
ebf846e8 255CREATE TABLE self_ref_alias (
256 self_ref integer NOT NULL,
257 alias integer NOT NULL,
258 PRIMARY KEY (self_ref, alias)
78060df8 259);
260
ebf846e8 261CREATE INDEX self_ref_alias_idx_alias_self_ ON self_ref_alias (alias);
262CREATE INDEX self_ref_alias_idx_self_ref_se ON self_ref_alias (self_ref);
263
78060df8 264--
ebf846e8 265-- Table: sequence_test
78060df8 266--
ebf846e8 267CREATE TABLE sequence_test (
268 pkid1 integer NOT NULL,
269 pkid2 integer NOT NULL,
270 nonpkid integer NOT NULL,
271 name varchar(100),
272 PRIMARY KEY (pkid1, pkid2)
78060df8 273);
274
ebf846e8 275
78060df8 276--
ebf846e8 277-- Table: serialized
78060df8 278--
ebf846e8 279CREATE TABLE serialized (
280 id INTEGER PRIMARY KEY NOT NULL,
281 serialized text NOT NULL
78060df8 282);
283
ebf846e8 284
78060df8 285--
ebf846e8 286-- Table: tags
78060df8 287--
ebf846e8 288CREATE TABLE tags (
289 tagid INTEGER PRIMARY KEY NOT NULL,
290 cd integer NOT NULL,
291 tag varchar(100) NOT NULL
78060df8 292);
293
ebf846e8 294CREATE INDEX tags_idx_cd_tags ON tags (cd);
295
78060df8 296--
ebf846e8 297-- Table: track
78060df8 298--
ebf846e8 299CREATE TABLE track (
300 trackid INTEGER PRIMARY KEY NOT NULL,
301 cd integer NOT NULL,
302 position integer NOT NULL,
303 title varchar(100) NOT NULL,
304 last_updated_on datetime
305);
306
307CREATE INDEX track_idx_cd_track ON track (cd);
308CREATE UNIQUE INDEX track_cd_position_track ON track (cd, position);
309CREATE UNIQUE INDEX track_cd_title_track ON track (cd, title);
310
311--
312-- Table: treelike
313--
314CREATE TABLE treelike (
78060df8 315 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 316 parent integer,
317 name varchar(100) NOT NULL
318);
319
320CREATE INDEX treelike_idx_parent_treelike ON treelike (parent);
321
322--
323-- Table: twokeytreelike
324--
325CREATE TABLE twokeytreelike (
326 id1 integer NOT NULL,
327 id2 integer NOT NULL,
328 parent1 integer NOT NULL,
329 parent2 integer NOT NULL,
330 name varchar(100) NOT NULL,
331 PRIMARY KEY (id1, id2)
332);
333
334CREATE INDEX twokeytreelike_idx_parent1_parent2_twokeytre ON twokeytreelike (parent1, parent2);
335CREATE UNIQUE INDEX tktlnameunique_twokeytreelike ON twokeytreelike (name);
336
337--
338-- Table: twokeys
339--
340CREATE TABLE twokeys (
341 artist integer NOT NULL,
342 cd integer NOT NULL,
343 PRIMARY KEY (artist, cd)
344);
345
346CREATE INDEX twokeys_idx_artist_twokeys ON twokeys (artist);
347
348--
349-- Table: typed_object
350--
351CREATE TABLE typed_object (
352 objectid INTEGER PRIMARY KEY NOT NULL,
353 type varchar(100) NOT NULL,
354 value varchar(100) NOT NULL
78060df8 355);
356
357
0009fa49 358COMMIT;