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