-
Notifications
You must be signed in to change notification settings - Fork 1
/
libstats.sql
334 lines (271 loc) · 12.3 KB
/
libstats.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
CREATE TABLE admin (
parent_table varchar(100) NOT NULL default '',
parent_pk varchar(100) NOT NULL default '',
descriptor varchar(100) NOT NULL default '',
display_name varchar(100) NOT NULL default '',
parent_finder varchar(100) NOT NULL default '',
edit_action_class varchar(100) NOT NULL default '',
bridge_table varchar(100) NOT NULL default '',
bridge_table_view int(10) NOT NULL default '0',
PRIMARY KEY (parent_table)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'admin'
--
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('locations','location_id','location_name','Locations','LocationFinder','libraryLocation.do','library_locations',1);
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('patron_types','patron_type_id','patron_type','Patron Types','PatronTypeFinder','libraryPatronType.do','library_patron_types',1);
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('question_formats','question_format_id','question_format','Question Formats','QuestionFormatFinder','libraryQuestionFormat.do','library_quesiton_formats',1);
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('question_types','question_type_id','question_type','Question Types','QuestionTypeFinder','libraryQuestionType.do','library_question_types',1);
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('time_spent_options','time_spent_id','time_spent','Time Spent Options','TimeSpentFinder','libraryTimeSpent.do','library_time_spent_options',1);
INSERT INTO admin (parent_table, parent_pk, descriptor, display_name, parent_finder, edit_action_class, bridge_table, bridge_table_view) VALUES ('libraries','library_id','short_name','Library','LibraryFinder','','',0);
--
-- Table structure for table 'cookie_logins'
--
CREATE TABLE cookie_logins (
cookie_login_id int(11) unsigned NOT NULL auto_increment,
cookie varchar(50) NOT NULL default '',
user_id int(11) unsigned NOT NULL default '0',
date_last_used datetime NOT NULL,
PRIMARY KEY (cookie_login_id),
UNIQUE KEY cookie (cookie)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'cookie_logins'
--
--
-- Table structure for table 'help_list'
--
CREATE TABLE help_list (
help_id int(11) NOT NULL auto_increment,
description text NOT NULL,
related_table varchar(100) NOT NULL default '',
help_name varchar(100) NOT NULL default '',
PRIMARY KEY (help_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'help_list'
--
--
-- Table structure for table 'libraries'
--
CREATE TABLE libraries (
library_id int(11) NOT NULL auto_increment,
full_name varchar(255) NOT NULL default '',
short_name varchar(255) NOT NULL default '',
PRIMARY KEY (library_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'libraries'
--
INSERT INTO libraries (library_id, full_name, short_name) VALUES (1,'Library','Library');
--
-- Table structure for table 'library_locations'
--
CREATE TABLE library_locations (
location_id int(11) unsigned NOT NULL auto_increment,
library_id int(11) unsigned NOT NULL default '0',
location_name varchar(255) NOT NULL default '',
list_order int(11) NOT NULL default '0',
PRIMARY KEY (location_id,library_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'library_locations'
--
INSERT INTO library_locations (location_id, library_id, location_name, list_order) VALUES (2,1,'Circulation',1);
INSERT INTO library_locations (location_id, library_id, location_name, list_order) VALUES (3,1,'Office',2);
INSERT INTO library_locations (location_id, library_id, location_name, list_order) VALUES (1,1,'Reference',0);
--
-- Table structure for table 'library_patron_types'
--
CREATE TABLE library_patron_types (
patron_type_id int(11) unsigned NOT NULL default '0',
library_id int(11) unsigned NOT NULL default '0',
list_order int(11) NOT NULL default '0',
PRIMARY KEY (library_id,patron_type_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'library_patron_types'
--
INSERT INTO library_patron_types (patron_type_id, library_id, list_order) VALUES (1,1,0);
INSERT INTO library_patron_types (patron_type_id, library_id, list_order) VALUES (2,1,0);
INSERT INTO library_patron_types (patron_type_id, library_id, list_order) VALUES (3,1,0);
--
-- Table structure for table 'library_question_formats'
--
CREATE TABLE library_question_formats (
question_format_id int(11) unsigned NOT NULL default '0',
library_id int(11) unsigned NOT NULL default '0',
list_order int(11) NOT NULL default '0',
PRIMARY KEY (question_format_id,library_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'library_question_formats'
--
INSERT INTO library_question_formats (question_format_id, library_id, list_order) VALUES (1,1,0);
INSERT INTO library_question_formats (question_format_id, library_id, list_order) VALUES (2,1,0);
INSERT INTO library_question_formats (question_format_id, library_id, list_order) VALUES (3,1,0);
--
-- Table structure for table 'library_question_types'
--
CREATE TABLE library_question_types (
question_type_id int(11) unsigned NOT NULL default '0',
library_id int(11) unsigned NOT NULL default '0',
list_order int(11) NOT NULL default '0',
PRIMARY KEY (question_type_id,library_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'library_question_types'
--
INSERT INTO library_question_types (question_type_id, library_id, list_order) VALUES (1,1,0);
INSERT INTO library_question_types (question_type_id, library_id, list_order) VALUES (2,1,0);
--
-- Table structure for table 'library_time_spent_options'
--
CREATE TABLE library_time_spent_options (
time_spent_id int(11) unsigned NOT NULL default '0',
library_id int(11) unsigned NOT NULL default '0',
list_order int(11) NOT NULL default '0',
PRIMARY KEY (time_spent_id,library_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'library_time_spent_options'
--
INSERT INTO library_time_spent_options (time_spent_id, library_id, list_order) VALUES (1,1,0);
INSERT INTO library_time_spent_options (time_spent_id, library_id, list_order) VALUES (2,1,0);
--
-- Table structure for table 'locations'
--
CREATE TABLE locations (
location_id int(11) NOT NULL auto_increment,
location_name varchar(100) NOT NULL default '',
parent_list int(11) NOT NULL default '0',
description text NOT NULL,
examples text NOT NULL,
PRIMARY KEY (location_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'locations'
--
INSERT INTO locations (location_id, location_name, parent_list, description, examples) VALUES (1,'Reference',0,'Reference Desk','');
INSERT INTO locations (location_id, location_name, parent_list, description, examples) VALUES (2,'Circulation',0,'Circ Desk','');
INSERT INTO locations (location_id, location_name, parent_list, description, examples) VALUES (3,'Office',0,'A staff office','');
--
-- Table structure for table 'patron_types'
--
CREATE TABLE patron_types (
examples text NOT NULL,
description text NOT NULL,
patron_type_id int(11) NOT NULL auto_increment,
patron_type varchar(50) NOT NULL default '',
parent_list int(11) NOT NULL default '0',
PRIMARY KEY (patron_type_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'patron_types'
--
INSERT INTO patron_types (examples, description, patron_type_id, patron_type, parent_list) VALUES ('','Any type of student',1,'Student',0);
INSERT INTO patron_types (examples, description, patron_type_id, patron_type, parent_list) VALUES ('','A faculty or staff member',2,'Fac/Staff',0);
INSERT INTO patron_types (examples, description, patron_type_id, patron_type, parent_list) VALUES ('','A patron from the surrounding community',3,'Community',0);
--
-- Table structure for table 'question_formats'
--
CREATE TABLE question_formats (
examples text NOT NULL,
description text NOT NULL,
question_format_id int(11) unsigned NOT NULL auto_increment,
question_format varchar(50) NOT NULL default '',
parent_list int(11) NOT NULL default '0',
PRIMARY KEY (question_format_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'question_formats'
--
INSERT INTO question_formats (examples, description, question_format_id, question_format, parent_list) VALUES ('','A patron asks for help in person',1,'Walk-Up',0);
INSERT INTO question_formats (examples, description, question_format_id, question_format, parent_list) VALUES ('','',3,'Phone',0);
INSERT INTO question_formats (examples, description, question_format_id, question_format, parent_list) VALUES ('','A question asked via email',2,'Email',0);
--
-- Table structure for table 'question_types'
--
CREATE TABLE question_types (
examples text NOT NULL,
description text NOT NULL,
question_type_id int(11) unsigned NOT NULL auto_increment,
parent_list int(11) NOT NULL default '0',
question_type varchar(50) NOT NULL default '',
PRIMARY KEY (question_type_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'question_types'
--
INSERT INTO question_types (examples, description, question_type_id, parent_list, question_type) VALUES ('','A purely directional question',1,0,'Directional');
INSERT INTO question_types (examples, description, question_type_id, parent_list, question_type) VALUES ('','',2,0,'Reference');
--
-- Table structure for table 'questions'
--
CREATE TABLE questions (
backup int(11) NOT NULL default '0',
updated int(11) NOT NULL default '0',
question_id int(11) unsigned NOT NULL auto_increment,
library_id int(11) unsigned NOT NULL default '0',
location_id int(11) unsigned NOT NULL default '0',
question_type_id int(11) unsigned NOT NULL default '0',
question_type_other varchar(30) default NULL,
time_spent_id int(11) unsigned default '0',
referral_id int(11) unsigned default '0',
patron_type_id int(11) unsigned default '0',
question_format_id int(11) unsigned default '0',
initials varchar(10) NOT NULL default '',
hide tinyint(2) unsigned NOT NULL default '0',
obsolete tinyint(2) unsigned NOT NULL default '0',
question_date datetime NOT NULL,
client_ip varchar(20) NOT NULL default '',
user_id int(11) unsigned NOT NULL default '0',
answer text NOT NULL,
question text NOT NULL,
delete_hide int(10) unsigned NOT NULL default '0',
date_added datetime NOT NULL,
PRIMARY KEY (question_id),
KEY k_question_date (question_date),
KEY initials (initials),
KEY library_id (library_id),
KEY question_id_libraries (library_id,client_ip(15),question_id),
KEY library_question_index (delete_hide,library_id,question_id,hide),
FULLTEXT KEY question (question),
FULLTEXT KEY answer (answer)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'questions'
--
--
-- Table structure for table 'time_spent_options'
--
CREATE TABLE time_spent_options (
examples text NOT NULL,
description text NOT NULL,
parent_list int(11) NOT NULL default '0',
time_spent_id int(10) unsigned NOT NULL auto_increment,
time_spent varchar(100) NOT NULL default '',
PRIMARY KEY (time_spent_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'time_spent_options'
--
INSERT INTO time_spent_options (examples, description, parent_list, time_spent_id, time_spent) VALUES ('','',0,1,'0-9 minutes');
INSERT INTO time_spent_options (examples, description, parent_list, time_spent_id, time_spent) VALUES ('','',0,2,'10+ minutes');
--
-- Table structure for table 'users'
--
CREATE TABLE users (
user_id int(11) NOT NULL auto_increment,
username varchar(50) NOT NULL default '',
password varchar(32) binary NOT NULL default '',
library_id int(11) NOT NULL default '0',
active tinyint(2) NOT NULL default '1',
admin tinyint(2) NOT NULL default '0',
PRIMARY KEY (user_id),
UNIQUE KEY username (username)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table 'users'
--
INSERT INTO users (user_id, username, password, library_id, active, admin) VALUES (1,'admin', md5('changeme'),1,1,1);