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