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