added new option to enforce Date or DateTime inflation, no matter what type the colum...
[dbsrgits/DBIx-Class.git] / t / lib / sqlite.sql
CommitLineData
0009fa49 1--
2-- Created by SQL::Translator::Producer::SQLite
a97fe7e0 3-- Created on Fri Oct 24 21:02:41 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,
a97fe7e0 117 created_on timestamp NOT NULL,
118 varchar_date varchar(20),
119 varchar_datetime varchar(20)
ab8481f5 120);
121
ebf846e8 122
ab8481f5 123--
4740bdb7 124-- Table: file_columns
125--
126CREATE TABLE file_columns (
127 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 128 file varchar(255) NOT NULL
4740bdb7 129);
130
ebf846e8 131
4740bdb7 132--
ebf846e8 133-- Table: forceforeign
77211009 134--
ebf846e8 135CREATE TABLE forceforeign (
136 artist INTEGER PRIMARY KEY NOT NULL,
137 cd integer NOT NULL
77211009 138);
139
ebf846e8 140CREATE INDEX forceforeign_idx_artist_forcef ON forceforeign (artist);
141
77211009 142--
ebf846e8 143-- Table: fourkeys
9c2c91ea 144--
ebf846e8 145CREATE TABLE fourkeys (
146 foo integer NOT NULL,
147 bar integer NOT NULL,
148 hello integer NOT NULL,
149 goodbye integer NOT NULL,
150 sensors character NOT NULL,
151 PRIMARY KEY (foo, bar, hello, goodbye)
0009fa49 152);
153
ebf846e8 154
0009fa49 155--
ebf846e8 156-- Table: fourkeys_to_twokeys
0009fa49 157--
ebf846e8 158CREATE TABLE fourkeys_to_twokeys (
159 f_foo integer NOT NULL,
160 f_bar integer NOT NULL,
161 f_hello integer NOT NULL,
162 f_goodbye integer NOT NULL,
163 t_artist integer NOT NULL,
164 t_cd integer NOT NULL,
165 autopilot character NOT NULL,
166 PRIMARY KEY (f_foo, f_bar, f_hello, f_goodbye, t_artist, t_cd)
0009fa49 167);
168
ebf846e8 169CREATE 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);
170CREATE INDEX fourkeys_to_twokeys_idx_t_artist_t_cd_fourkeys_to ON fourkeys_to_twokeys (t_artist, t_cd);
171
887ce227 172--
ebf846e8 173-- Table: genre
887ce227 174--
ebf846e8 175CREATE TABLE genre (
87310237 176 genreid INTEGER PRIMARY KEY NOT NULL,
177 name varchar(100) NOT NULL
9c2c91ea 178);
179
87310237 180CREATE UNIQUE INDEX genre_name_genre ON genre (name);
ebf846e8 181
182--
183-- Table: liner_notes
184--
185CREATE TABLE liner_notes (
186 liner_id INTEGER PRIMARY KEY NOT NULL,
187 notes varchar(100) NOT NULL
188);
189
190
191--
192-- Table: link
193--
194CREATE TABLE link (
195 id INTEGER PRIMARY KEY NOT NULL,
196 url varchar(100),
197 title varchar(100)
198);
199
200
9c2c91ea 201--
89034887 202-- Table: noprimarykey
203--
204CREATE TABLE noprimarykey (
205 foo integer NOT NULL,
206 bar integer NOT NULL,
207 baz integer NOT NULL
208);
209
ebf846e8 210CREATE UNIQUE INDEX foo_bar_noprimarykey ON noprimarykey (foo, bar);
211
89034887 212--
ebf846e8 213-- Table: onekey
9c2c91ea 214--
ebf846e8 215CREATE TABLE onekey (
216 id INTEGER PRIMARY KEY NOT NULL,
217 artist integer NOT NULL,
218 cd integer NOT NULL
9c2c91ea 219);
220
ebf846e8 221
9c2c91ea 222--
ebf846e8 223-- Table: owners
9c2c91ea 224--
ebf846e8 225CREATE TABLE owners (
226 ownerid INTEGER PRIMARY KEY NOT NULL,
227 name varchar(100) NOT NULL
9c2c91ea 228);
229
ebf846e8 230
9c2c91ea 231--
232-- Table: producer
233--
234CREATE TABLE producer (
235 producerid INTEGER PRIMARY KEY NOT NULL,
8fcf21b3 236 name varchar(100) NOT NULL
887ce227 237);
238
ebf846e8 239CREATE UNIQUE INDEX prod_name_producer ON producer (name);
240
9fcda149 241--
ebf846e8 242-- Table: self_ref
9fcda149 243--
ebf846e8 244CREATE TABLE self_ref (
8fcf21b3 245 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 246 name varchar(100) NOT NULL
9fcda149 247);
248
ebf846e8 249
78060df8 250--
ebf846e8 251-- Table: self_ref_alias
78060df8 252--
ebf846e8 253CREATE TABLE self_ref_alias (
254 self_ref integer NOT NULL,
255 alias integer NOT NULL,
256 PRIMARY KEY (self_ref, alias)
78060df8 257);
258
ebf846e8 259CREATE INDEX self_ref_alias_idx_alias_self_ ON self_ref_alias (alias);
260CREATE INDEX self_ref_alias_idx_self_ref_se ON self_ref_alias (self_ref);
261
78060df8 262--
ebf846e8 263-- Table: sequence_test
78060df8 264--
ebf846e8 265CREATE TABLE sequence_test (
266 pkid1 integer NOT NULL,
267 pkid2 integer NOT NULL,
268 nonpkid integer NOT NULL,
269 name varchar(100),
270 PRIMARY KEY (pkid1, pkid2)
78060df8 271);
272
ebf846e8 273
78060df8 274--
ebf846e8 275-- Table: serialized
78060df8 276--
ebf846e8 277CREATE TABLE serialized (
278 id INTEGER PRIMARY KEY NOT NULL,
279 serialized text NOT NULL
78060df8 280);
281
ebf846e8 282
78060df8 283--
ebf846e8 284-- Table: tags
78060df8 285--
ebf846e8 286CREATE TABLE tags (
287 tagid INTEGER PRIMARY KEY NOT NULL,
288 cd integer NOT NULL,
289 tag varchar(100) NOT NULL
78060df8 290);
291
ebf846e8 292CREATE INDEX tags_idx_cd_tags ON tags (cd);
293
78060df8 294--
ebf846e8 295-- Table: track
78060df8 296--
ebf846e8 297CREATE TABLE track (
298 trackid INTEGER PRIMARY KEY NOT NULL,
299 cd integer NOT NULL,
300 position integer NOT NULL,
301 title varchar(100) NOT NULL,
302 last_updated_on datetime
303);
304
305CREATE INDEX track_idx_cd_track ON track (cd);
306CREATE UNIQUE INDEX track_cd_position_track ON track (cd, position);
307CREATE UNIQUE INDEX track_cd_title_track ON track (cd, title);
308
309--
310-- Table: treelike
311--
312CREATE TABLE treelike (
78060df8 313 id INTEGER PRIMARY KEY NOT NULL,
ebf846e8 314 parent integer,
315 name varchar(100) NOT NULL
316);
317
318CREATE INDEX treelike_idx_parent_treelike ON treelike (parent);
319
320--
321-- Table: twokeytreelike
322--
323CREATE TABLE twokeytreelike (
324 id1 integer NOT NULL,
325 id2 integer NOT NULL,
326 parent1 integer NOT NULL,
327 parent2 integer NOT NULL,
328 name varchar(100) NOT NULL,
329 PRIMARY KEY (id1, id2)
330);
331
332CREATE INDEX twokeytreelike_idx_parent1_parent2_twokeytre ON twokeytreelike (parent1, parent2);
333CREATE UNIQUE INDEX tktlnameunique_twokeytreelike ON twokeytreelike (name);
334
335--
336-- Table: twokeys
337--
338CREATE TABLE twokeys (
339 artist integer NOT NULL,
340 cd integer NOT NULL,
341 PRIMARY KEY (artist, cd)
342);
343
344CREATE INDEX twokeys_idx_artist_twokeys ON twokeys (artist);
345
346--
347-- Table: typed_object
348--
349CREATE TABLE typed_object (
350 objectid INTEGER PRIMARY KEY NOT NULL,
351 type varchar(100) NOT NULL,
352 value varchar(100) NOT NULL
78060df8 353);
354
355
0009fa49 356COMMIT;