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