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