]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/002.schema.config.sql
correcting default proximity protection
[working/Evergreen.git] / Open-ILS / src / sql / Pg / 002.schema.config.sql
1
2 DROP SCHEMA config CASCADE;
3
4 BEGIN;
5 CREATE SCHEMA config;
6 COMMENT ON SCHEMA config IS $$
7 /*
8  * Copyright (C) 2005  Georgia Public Library Service 
9  * Mike Rylander <mrylander@gmail.com>
10  *
11  * The config schema holds static configuration data for the
12  * Open-ILS installation.
13  *
14  * ****
15  *
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  */
26 $$;
27
28
29 CREATE TABLE config.bib_source (
30         id      SERIAL  PRIMARY KEY,
31         quality INT     CHECK ( quality BETWEEN 0 AND 100 ),
32         source  TEXT    NOT NULL UNIQUE
33 );
34 COMMENT ON TABLE config.bib_source IS $$
35 /*
36  * Copyright (C) 2005  Georgia Public Library Service 
37  * Mike Rylander <mrylander@gmail.com>
38  *
39  * Valid sources of MARC records
40  *
41  * This is table is used to set up the relative "quality" of each
42  * MARC source, such as OCLC.
43  *
44  * ****
45  *
46  * This program is free software; you can redistribute it and/or
47  * modify it under the terms of the GNU General Public License
48  * as published by the Free Software Foundation; either version 2
49  * of the License, or (at your option) any later version.
50  *
51  * This program is distributed in the hope that it will be useful,
52  * but WITHOUT ANY WARRANTY; without even the implied warranty of
53  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54  * GNU General Public License for more details.
55  */
56 $$;
57
58
59 INSERT INTO config.bib_source (quality, source) VALUES (90, 'OcLC');
60 INSERT INTO config.bib_source (quality, source) VALUES (10, 'System Local');
61
62 CREATE TABLE config.standing (
63         id              SERIAL  PRIMARY KEY,
64         value           TEXT    NOT NULL UNIQUE
65 );
66 COMMENT ON TABLE config.standing IS $$
67 /*
68  * Copyright (C) 2005  Georgia Public Library Service 
69  * Mike Rylander <mrylander@gmail.com>
70  *
71  * Patron Standings
72  *
73  * This table contains the values that can be applied to a patron
74  * by a staff member.  These values should not be changed, other
75  * that for translation, as the ID column is currently a "magic
76  * number" in the source. :(
77  *
78  * ****
79  *
80  * This program is free software; you can redistribute it and/or
81  * modify it under the terms of the GNU General Public License
82  * as published by the Free Software Foundation; either version 2
83  * of the License, or (at your option) any later version.
84  *
85  * This program is distributed in the hope that it will be useful,
86  * but WITHOUT ANY WARRANTY; without even the implied warranty of
87  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
88  * GNU General Public License for more details.
89  */
90 $$;
91
92 INSERT INTO config.standing (value) VALUES ('Good');
93 INSERT INTO config.standing (value) VALUES ('Barred');
94
95
96
97 CREATE TABLE config.metabib_field (
98         id              SERIAL  PRIMARY KEY,
99         field_class     TEXT    NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
100         name            TEXT    NOT NULL UNIQUE,
101         xpath           TEXT    NOT NULL
102 );
103 COMMENT ON TABLE config.metabib_field IS $$
104 /*
105  * Copyright (C) 2005  Georgia Public Library Service 
106  * Mike Rylander <mrylander@gmail.com>
107  *
108  * XPath used for WoRMing
109  *
110  * This table contains the XPath used to chop up MODS into it's
111  * indexable parts.  Each XPath entry is named and assigned to
112  * a "class" of either title, subject, author, keyword or series.
113  * 
114  *
115  * ****
116  *
117  * This program is free software; you can redistribute it and/or
118  * modify it under the terms of the GNU General Public License
119  * as published by the Free Software Foundation; either version 2
120  * of the License, or (at your option) any later version.
121  *
122  * This program is distributed in the hope that it will be useful,
123  * but WITHOUT ANY WARRANTY; without even the implied warranty of
124  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
125  * GNU General Public License for more details.
126  */
127 $$;
128
129
130 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'series', 'seriestitle', $$//mods:mods/mods:relatedItem[@type="series"]/mods:titleInfo$$ );
131 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'abbreviated', $$//mods:mods/mods:titleInfo[mods:title and (@type='abreviated')]$$ );
132 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'translated', $$//mods:mods/mods:titleInfo[mods:title and (@type='translated')]$$ );
133 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'uniform', $$//mods:mods/mods:titleInfo[mods:title and (@type='uniform')]$$ );
134 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods:title and not (@type)]$$ );
135 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'corporate', $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
136 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'personal', $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
137 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'conference', $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
138 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'other', $$//mods:mods/mods:name[@type='personal']/mods:namePart[not(../mods:role)]$$ );
139 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'geographic', $$//mods:mods/mods:subject/mods:geographic$$ );
140 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'name', $$//mods:mods/mods:subject/mods:name$$ );
141 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'temporal', $$//mods:mods/mods:subject/mods:temporal$$ );
142 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'topic', $$//mods:mods/mods:subject/mods:topic$$ );
143 -- INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods:mods/mods:genre$$ );
144 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'keyword', 'keyword', $$//mods:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */
145
146 CREATE TABLE config.identification_type (
147         id              SERIAL  PRIMARY KEY,
148         name            TEXT    NOT NULL UNIQUE
149 );
150 COMMENT ON TABLE config.identification_type IS $$
151 /*
152  * Copyright (C) 2005  Georgia Public Library Service 
153  * Mike Rylander <mrylander@gmail.com>
154  *
155  * Types of valid patron identification.
156  *
157  * Each patron must display at least one valid form of identification
158  * in order to get a library card.  This table lists those forms.
159  * 
160  *
161  * ****
162  *
163  * This program is free software; you can redistribute it and/or
164  * modify it under the terms of the GNU General Public License
165  * as published by the Free Software Foundation; either version 2
166  * of the License, or (at your option) any later version.
167  *
168  * This program is distributed in the hope that it will be useful,
169  * but WITHOUT ANY WARRANTY; without even the implied warranty of
170  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
171  * GNU General Public License for more details.
172  */
173 $$;
174
175
176 INSERT INTO config.identification_type ( name ) VALUES ( 'Drivers Licence' );
177 INSERT INTO config.identification_type ( name ) VALUES ( 'Voter Card' );
178 INSERT INTO config.identification_type ( name ) VALUES ( 'Two Utility Bills' );
179 INSERT INTO config.identification_type ( name ) VALUES ( 'State ID' );
180 INSERT INTO config.identification_type ( name ) VALUES ( 'SSN' );
181
182 CREATE TABLE config.rule_circ_duration (
183         id              SERIAL          PRIMARY KEY,
184         name            TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
185         extended        INTERVAL        NOT NULL,
186         normal          INTERVAL        NOT NULL,
187         shrt            INTERVAL        NOT NULL,
188         max_renewals    INT             NOT NULL
189 );
190 COMMENT ON TABLE config.rule_circ_duration IS $$
191 /*
192  * Copyright (C) 2005  Georgia Public Library Service 
193  * Mike Rylander <mrylander@gmail.com>
194  *
195  * Circulation Duration rules
196  *
197  * Each circulation is given a duration based on one of these rules.
198  * 
199  *
200  * ****
201  *
202  * This program is free software; you can redistribute it and/or
203  * modify it under the terms of the GNU General Public License
204  * as published by the Free Software Foundation; either version 2
205  * of the License, or (at your option) any later version.
206  *
207  * This program is distributed in the hope that it will be useful,
208  * but WITHOUT ANY WARRANTY; without even the implied warranty of
209  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
210  * GNU General Public License for more details.
211  */
212 $$;
213
214 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '2wk_default', '21 days', '14 days', '7 days', 2);
215
216
217 CREATE TABLE config.rule_max_fine (
218         id      SERIAL          PRIMARY KEY,
219         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
220         amount  NUMERIC(6,2)    NOT NULL
221 );
222 COMMENT ON TABLE config.rule_max_fine IS $$
223 /*
224  * Copyright (C) 2005  Georgia Public Library Service 
225  * Mike Rylander <mrylander@gmail.com>
226  *
227  * Circulation Max Fine rules
228  *
229  * Each circulation is given a maximum fine based on one of
230  * these rules.
231  * 
232  *
233  * ****
234  *
235  * This program is free software; you can redistribute it and/or
236  * modify it under the terms of the GNU General Public License
237  * as published by the Free Software Foundation; either version 2
238  * of the License, or (at your option) any later version.
239  *
240  * This program is distributed in the hope that it will be useful,
241  * but WITHOUT ANY WARRANTY; without even the implied warranty of
242  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
243  * GNU General Public License for more details.
244  */
245 $$;
246
247 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'books', 50.00);
248
249
250 CREATE TABLE config.rule_recuring_fine (
251         id                      SERIAL          PRIMARY KEY,
252         name                    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
253         high                    NUMERIC(6,2)    NOT NULL,
254         normal                  NUMERIC(6,2)    NOT NULL,
255         low                     NUMERIC(6,2)    NOT NULL,
256         recurance_interval      INTERVAL        NOT NULL DEFAULT '1 day'::INTERVAL
257 );
258 COMMENT ON TABLE config.rule_recuring_fine IS $$
259 /*
260  * Copyright (C) 2005  Georgia Public Library Service 
261  * Mike Rylander <mrylander@gmail.com>
262  *
263  * Circulation Recuring Fine rules
264  *
265  * Each circulation is given a recuring fine amount based on one of
266  * these rules.  The recurance_interval should not be any shorter
267  * than the interval between runs of the fine_processor.pl script
268  * (which is run from CRON), or you could miss fines.
269  * 
270  *
271  * ****
272  *
273  * This program is free software; you can redistribute it and/or
274  * modify it under the terms of the GNU General Public License
275  * as published by the Free Software Foundation; either version 2
276  * of the License, or (at your option) any later version.
277  *
278  * This program is distributed in the hope that it will be useful,
279  * but WITHOUT ANY WARRANTY; without even the implied warranty of
280  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
281  * GNU General Public License for more details.
282  */
283 $$;
284
285 INSERT INTO config.rule_recuring_fine VALUES (1, 'books', 0.50, 0.10, 0.10, '1 day');
286
287
288 CREATE TABLE config.rule_age_hold_protect (
289         id      SERIAL          PRIMARY KEY,
290         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
291         age     INTERVAL        NOT NULL,
292         prox    INT             NOT NULL
293 );
294 COMMENT ON TABLE config.rule_age_hold_protect IS $$
295 /*
296  * Copyright (C) 2005  Georgia Public Library Service 
297  * Mike Rylander <mrylander@gmail.com>
298  *
299  * Hold Item Age Protection rules
300  *
301  * A hold request can only capture new(ish) items when they are
302  * within a particular proximity of the home_ou of the requesting
303  * user.  The proximity ('prox' column) is calculated by counting
304  * the number of tree edges beween the user's home_ou and the owning_lib
305  * of the copy that could fulfill the hold.
306  * 
307  *
308  * ****
309  *
310  * This program is free software; you can redistribute it and/or
311  * modify it under the terms of the GNU General Public License
312  * as published by the Free Software Foundation; either version 2
313  * of the License, or (at your option) any later version.
314  *
315  * This program is distributed in the hope that it will be useful,
316  * but WITHOUT ANY WARRANTY; without even the implied warranty of
317  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
318  * GNU General Public License for more details.
319  */
320 $$;
321
322 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '3month', '3 mons', 0);
323 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '6month', '6 mons', 2);
324
325
326 CREATE TABLE config.copy_status (
327         id              SERIAL  PRIMARY KEY,
328         name            TEXT    NOT NULL UNIQUE,
329         holdable        BOOL    NOT NULL DEFAULT FALSE
330 );
331 COMMENT ON TABLE config.copy_status IS $$
332 /*
333  * Copyright (C) 2005  Georgia Public Library Service 
334  * Mike Rylander <mrylander@gmail.com>
335  *
336  * Copy Statuses
337  *
338  * The available copy statuses, and whether a copy in that
339  * status is available for hold request capture.  0 (zero) is
340  * the only special number in this set, meaning that the item
341  * is available for imediate checkout, and is counted as available
342  * in the OPAC.
343  *
344  * Statuses with an ID below 100 are not removable, and have special
345  * meaning in the code.  Do not change them except to translate the
346  * textual name.
347  *
348  * You may add and remove statuses above 100, and these can be used
349  * to remove items from normal circulation without affecting the rest
350  * of the copy's values or it's location.
351  *
352  * ****
353  *
354  * This program is free software; you can redistribute it and/or
355  * modify it under the terms of the GNU General Public License
356  * as published by the Free Software Foundation; either version 2
357  * of the License, or (at your option) any later version.
358  *
359  * This program is distributed in the hope that it will be useful,
360  * but WITHOUT ANY WARRANTY; without even the implied warranty of
361  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
362  * GNU General Public License for more details.
363  */
364 $$;
365
366 INSERT INTO config.copy_status (id,name,holdable)       VALUES (0,'Available','t');
367 INSERT INTO config.copy_status (name,holdable)          VALUES ('Checked out','t');
368 INSERT INTO config.copy_status (name)                   VALUES ('Bindery');
369 INSERT INTO config.copy_status (name)                   VALUES ('Lost');
370 INSERT INTO config.copy_status (name)                   VALUES ('Missing');
371 INSERT INTO config.copy_status (name,holdable)          VALUES ('In process','t');
372 INSERT INTO config.copy_status (name,holdable)          VALUES ('In transit','t');
373 INSERT INTO config.copy_status (name,holdable)          VALUES ('Reshelving','t');
374 INSERT INTO config.copy_status (name)                   VALUES ('On holds shelf');
375 INSERT INTO config.copy_status (name,holdable)          VALUES ('On order','t');
376 INSERT INTO config.copy_status (name)                   VALUES ('ILL');
377 INSERT INTO config.copy_status (name)                   VALUES ('Cataloging');
378 INSERT INTO config.copy_status (name)                   VALUES ('Reserves');
379 INSERT INTO config.copy_status (name)                   VALUES ('Discard/Weed');
380
381 SELECT SETVAL('config.copy_status_id_seq'::TEXT, 100);
382
383
384 CREATE TABLE config.net_access_level (
385         id      SERIAL          PRIMARY KEY,
386         name    TEXT            NOT NULL UNIQUE
387 );
388 COMMENT ON TABLE config.net_access_level IS $$
389 /*
390  * Copyright (C) 2005  Georgia Public Library Service 
391  * Mike Rylander <mrylander@gmail.com>
392  *
393  * Patron Network Access level
394  *
395  * This will be used to inform the in-library firewall of how much
396  * internet access the using patron should be allowed.
397  *
398  * ****
399  *
400  * This program is free software; you can redistribute it and/or
401  * modify it under the terms of the GNU General Public License
402  * as published by the Free Software Foundation; either version 2
403  * of the License, or (at your option) any later version.
404  *
405  * This program is distributed in the hope that it will be useful,
406  * but WITHOUT ANY WARRANTY; without even the implied warranty of
407  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
408  * GNU General Public License for more details.
409  */
410 $$;
411
412 INSERT INTO config.net_access_level (name) VALUES ('Restricted');
413 INSERT INTO config.net_access_level (name) VALUES ('Full');
414 INSERT INTO config.net_access_level (name) VALUES ('None');
415
416
417 COMMIT;