2 * Copyright (C) 2004-2008 Georgia Public Library Service
3 * Copyright (C) 2008 Equinox Software, Inc.
4 * Mike Rylander <miker@esilibrary.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
20 DROP SCHEMA stats CASCADE;
21 DROP SCHEMA config CASCADE;
27 COMMENT ON SCHEMA config IS $$
29 * Copyright (C) 2005 Georgia Public Library Service
30 * Mike Rylander <mrylander@gmail.com>
32 * The config schema holds static configuration data for the
33 * Open-ILS installation.
37 * This program is free software; you can redistribute it and/or
38 * modify it under the terms of the GNU General Public License
39 * as published by the Free Software Foundation; either version 2
40 * of the License, or (at your option) any later version.
42 * This program is distributed in the hope that it will be useful,
43 * but WITHOUT ANY WARRANTY; without even the implied warranty of
44 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 * GNU General Public License for more details.
49 CREATE TABLE config.upgrade_log (
50 version TEXT PRIMARY KEY,
51 install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
54 CREATE TABLE config.bib_source (
55 id SERIAL PRIMARY KEY,
56 quality INT CHECK ( quality BETWEEN 0 AND 100 ),
57 source TEXT NOT NULL UNIQUE,
58 transcendant BOOL NOT NULL DEFAULT FALSE
60 COMMENT ON TABLE config.bib_source IS $$
62 * Copyright (C) 2005 Georgia Public Library Service
63 * Mike Rylander <mrylander@gmail.com>
65 * Valid sources of MARC records
67 * This is table is used to set up the relative "quality" of each
68 * MARC source, such as OCLC.
72 * This program is free software; you can redistribute it and/or
73 * modify it under the terms of the GNU General Public License
74 * as published by the Free Software Foundation; either version 2
75 * of the License, or (at your option) any later version.
77 * This program is distributed in the hope that it will be useful,
78 * but WITHOUT ANY WARRANTY; without even the implied warranty of
79 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
80 * GNU General Public License for more details.
84 CREATE TABLE config.standing (
85 id SERIAL PRIMARY KEY,
86 value TEXT NOT NULL UNIQUE
88 COMMENT ON TABLE config.standing IS $$
90 * Copyright (C) 2005 Georgia Public Library Service
91 * Mike Rylander <mrylander@gmail.com>
95 * This table contains the values that can be applied to a patron
96 * by a staff member. These values should not be changed, other
97 * than for translation, as the ID column is currently a "magic
98 * number" in the source. :(
102 * This program is free software; you can redistribute it and/or
103 * modify it under the terms of the GNU General Public License
104 * as published by the Free Software Foundation; either version 2
105 * of the License, or (at your option) any later version.
107 * This program is distributed in the hope that it will be useful,
108 * but WITHOUT ANY WARRANTY; without even the implied warranty of
109 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110 * GNU General Public License for more details.
114 CREATE TABLE config.standing_penalty (
115 id SERIAL PRIMARY KEY,
116 name TEXT NOT NULL UNIQUE,
120 INSERT INTO config.standing_penalty (id,name,label,block_list)
121 VALUES (1,'PATRON_EXCEEDS_FINES','Patron exceeds fine threshold','CIRC|HOLD|RENEW');
122 INSERT INTO config.standing_penalty (id,name,label,block_list)
123 VALUES (2,'PATRON_EXCEEDS_OVERDUE_COUNT','Patron exceeds max overdue item threshold','CIRC|HOLD|RENEW');
124 INSERT INTO config.standing_penalty (id,name,label,block_list)
125 VALUES (3,'PATRON_EXCEEDS_CHECKOUT_COUNT','Patron exceeds max checked out item threshold','CIRC');
126 INSERT INTO config.standing_penalty (id,name,label,block_list)
127 VALUES (4,'PATRON_EXCEEDS_COLLECTIONS_WARNING','Patron exceeds pre-collections warning fine threshold','CIRC|HOLD|RENEW');
129 INSERT INTO config.standing_penalty (id,name,label) VALUES (20,'ALERT_NOTE','Alerting Note, no blocks');
130 INSERT INTO config.standing_penalty (id,name,label) VALUES (21,'SILENT_NOTE','Note, no blocks');
131 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (22,'STAFF_C','Alerting block on Circ','CIRC');
132 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (23,'STAFF_CH','Alerting block on Circ and Hold','CIRC|HOLD');
133 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (24,'STAFF_CR','Alerting block on Circ and Renew','CIRC|RENEW');
134 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (25,'STAFF_CHR','Alerting block on Circ, Hold and Renew','CIRC|HOLD|RENEW');
135 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (26,'STAFF_HR','Alerting block on Hold and Renew','HOLD|RENEW');
136 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (27,'STAFF_H','Alerting block on Hold','HOLD');
137 INSERT INTO config.standing_penalty (id,name,label,block_list) VALUES (28,'STAFF_R','Alerting block on Renew','RENEW');
139 SELECT SETVAL('config.standing_penalty_id_seq', 100);
141 CREATE TABLE config.xml_transform (
142 name TEXT PRIMARY KEY,
143 namespace_uri TEXT NOT NULL,
144 prefix TEXT NOT NULL,
148 CREATE TABLE config.metabib_field (
149 id SERIAL PRIMARY KEY,
150 field_class TEXT NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
153 weight INT NOT NULL DEFAULT 1,
154 format TEXT NOT NULL DEFAULT 'mods33',
155 search_field BOOL NOT NULL DEFAULT TRUE,
156 facet_field BOOL NOT NULL DEFAULT FALSE
158 COMMENT ON TABLE config.metabib_field IS $$
160 * Copyright (C) 2005 Georgia Public Library Service
161 * Mike Rylander <mrylander@gmail.com>
163 * XPath used for record indexing ingest
165 * This table contains the XPath used to chop up MODS into its
166 * indexable parts. Each XPath entry is named and assigned to
167 * a "class" of either title, subject, author, keyword or series.
172 * This program is free software; you can redistribute it and/or
173 * modify it under the terms of the GNU General Public License
174 * as published by the Free Software Foundation; either version 2
175 * of the License, or (at your option) any later version.
177 * This program is distributed in the hope that it will be useful,
178 * but WITHOUT ANY WARRANTY; without even the implied warranty of
179 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
180 * GNU General Public License for more details.
184 CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
186 CREATE TABLE config.non_cataloged_type (
187 id SERIAL PRIMARY KEY,
188 owning_lib INT NOT NULL, -- REFERENCES actor.org_unit (id),
190 circ_duration INTERVAL NOT NULL DEFAULT '14 days'::INTERVAL,
191 in_house BOOL NOT NULL DEFAULT FALSE,
192 CONSTRAINT noncat_once_per_lib UNIQUE (owning_lib,name)
194 COMMENT ON TABLE config.non_cataloged_type IS $$
196 * Copyright (C) 2005 Georgia Public Library Service
197 * Mike Rylander <mrylander@gmail.com>
199 * Types of valid non-cataloged items.
204 * This program is free software; you can redistribute it and/or
205 * modify it under the terms of the GNU General Public License
206 * as published by the Free Software Foundation; either version 2
207 * of the License, or (at your option) any later version.
209 * This program is distributed in the hope that it will be useful,
210 * but WITHOUT ANY WARRANTY; without even the implied warranty of
211 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
212 * GNU General Public License for more details.
216 CREATE TABLE config.identification_type (
217 id SERIAL PRIMARY KEY,
218 name TEXT NOT NULL UNIQUE
220 COMMENT ON TABLE config.identification_type IS $$
222 * Copyright (C) 2005 Georgia Public Library Service
223 * Mike Rylander <mrylander@gmail.com>
225 * Types of valid patron identification.
227 * Each patron must display at least one valid form of identification
228 * in order to get a library card. This table lists those forms.
233 * This program is free software; you can redistribute it and/or
234 * modify it under the terms of the GNU General Public License
235 * as published by the Free Software Foundation; either version 2
236 * of the License, or (at your option) any later version.
238 * This program is distributed in the hope that it will be useful,
239 * but WITHOUT ANY WARRANTY; without even the implied warranty of
240 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
241 * GNU General Public License for more details.
245 CREATE TABLE config.rule_circ_duration (
246 id SERIAL PRIMARY KEY,
247 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
248 extended INTERVAL NOT NULL,
249 normal INTERVAL NOT NULL,
250 shrt INTERVAL NOT NULL,
251 max_renewals INT NOT NULL
253 COMMENT ON TABLE config.rule_circ_duration IS $$
255 * Copyright (C) 2005 Georgia Public Library Service
256 * Mike Rylander <mrylander@gmail.com>
258 * Circulation Duration rules
260 * Each circulation is given a duration based on one of these rules.
265 * This program is free software; you can redistribute it and/or
266 * modify it under the terms of the GNU General Public License
267 * as published by the Free Software Foundation; either version 2
268 * of the License, or (at your option) any later version.
270 * This program is distributed in the hope that it will be useful,
271 * but WITHOUT ANY WARRANTY; without even the implied warranty of
272 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
273 * GNU General Public License for more details.
277 CREATE TABLE config.rule_max_fine (
278 id SERIAL PRIMARY KEY,
279 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
280 amount NUMERIC(6,2) NOT NULL,
281 is_percent BOOL NOT NULL DEFAULT FALSE
283 COMMENT ON TABLE config.rule_max_fine IS $$
285 * Copyright (C) 2005 Georgia Public Library Service
286 * Mike Rylander <mrylander@gmail.com>
288 * Circulation Max Fine rules
290 * Each circulation is given a maximum fine based on one of
296 * This program is free software; you can redistribute it and/or
297 * modify it under the terms of the GNU General Public License
298 * as published by the Free Software Foundation; either version 2
299 * of the License, or (at your option) any later version.
301 * This program is distributed in the hope that it will be useful,
302 * but WITHOUT ANY WARRANTY; without even the implied warranty of
303 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 * GNU General Public License for more details.
308 CREATE TABLE config.rule_recuring_fine (
309 id SERIAL PRIMARY KEY,
310 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
311 high NUMERIC(6,2) NOT NULL,
312 normal NUMERIC(6,2) NOT NULL,
313 low NUMERIC(6,2) NOT NULL,
314 recurance_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL
316 COMMENT ON TABLE config.rule_recuring_fine IS $$
318 * Copyright (C) 2005 Georgia Public Library Service
319 * Mike Rylander <mrylander@gmail.com>
321 * Circulation Recurring Fine rules
323 * Each circulation is given a recurring fine amount based on one of
324 * these rules. The recurance_interval should not be any shorter
325 * than the interval between runs of the fine_processor.pl script
326 * (which is run from CRON), or you could miss fines.
331 * This program is free software; you can redistribute it and/or
332 * modify it under the terms of the GNU General Public License
333 * as published by the Free Software Foundation; either version 2
334 * of the License, or (at your option) any later version.
336 * This program is distributed in the hope that it will be useful,
337 * but WITHOUT ANY WARRANTY; without even the implied warranty of
338 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
339 * GNU General Public License for more details.
344 CREATE TABLE config.rule_age_hold_protect (
345 id SERIAL PRIMARY KEY,
346 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
347 age INTERVAL NOT NULL,
350 COMMENT ON TABLE config.rule_age_hold_protect IS $$
352 * Copyright (C) 2005 Georgia Public Library Service
353 * Mike Rylander <mrylander@gmail.com>
355 * Hold Item Age Protection rules
357 * A hold request can only capture new(ish) items when they are
358 * within a particular proximity of the home_ou of the requesting
359 * user. The proximity ('prox' column) is calculated by counting
360 * the number of tree edges between the user's home_ou and the owning_lib
361 * of the copy that could fulfill the hold.
366 * This program is free software; you can redistribute it and/or
367 * modify it under the terms of the GNU General Public License
368 * as published by the Free Software Foundation; either version 2
369 * of the License, or (at your option) any later version.
371 * This program is distributed in the hope that it will be useful,
372 * but WITHOUT ANY WARRANTY; without even the implied warranty of
373 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
374 * GNU General Public License for more details.
378 CREATE TABLE config.copy_status (
379 id SERIAL PRIMARY KEY,
380 name TEXT NOT NULL UNIQUE,
381 holdable BOOL NOT NULL DEFAULT FALSE,
382 opac_visible BOOL NOT NULL DEFAULT FALSE
384 COMMENT ON TABLE config.copy_status IS $$
386 * Copyright (C) 2005 Georgia Public Library Service
387 * Mike Rylander <mrylander@gmail.com>
391 * The available copy statuses, and whether a copy in that
392 * status is available for hold request capture. 0 (zero) is
393 * the only special number in this set, meaning that the item
394 * is available for immediate checkout, and is counted as available
397 * Statuses with an ID below 100 are not removable, and have special
398 * meaning in the code. Do not change them except to translate the
401 * You may add and remove statuses above 100, and these can be used
402 * to remove items from normal circulation without affecting the rest
403 * of the copy's values or its location.
407 * This program is free software; you can redistribute it and/or
408 * modify it under the terms of the GNU General Public License
409 * as published by the Free Software Foundation; either version 2
410 * of the License, or (at your option) any later version.
412 * This program is distributed in the hope that it will be useful,
413 * but WITHOUT ANY WARRANTY; without even the implied warranty of
414 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
415 * GNU General Public License for more details.
419 CREATE TABLE config.net_access_level (
420 id SERIAL PRIMARY KEY,
421 name TEXT NOT NULL UNIQUE
423 COMMENT ON TABLE config.net_access_level IS $$
425 * Copyright (C) 2005 Georgia Public Library Service
426 * Mike Rylander <mrylander@gmail.com>
428 * Patron Network Access level
430 * This will be used to inform the in-library firewall of how much
431 * internet access the using patron should be allowed.
435 * This program is free software; you can redistribute it and/or
436 * modify it under the terms of the GNU General Public License
437 * as published by the Free Software Foundation; either version 2
438 * of the License, or (at your option) any later version.
440 * This program is distributed in the hope that it will be useful,
441 * but WITHOUT ANY WARRANTY; without even the implied warranty of
442 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
443 * GNU General Public License for more details.
447 CREATE TABLE config.audience_map (
448 code TEXT PRIMARY KEY,
453 CREATE TABLE config.lit_form_map (
454 code TEXT PRIMARY KEY,
459 CREATE TABLE config.language_map (
460 code TEXT PRIMARY KEY,
464 CREATE TABLE config.item_form_map (
465 code TEXT PRIMARY KEY,
469 CREATE TABLE config.item_type_map (
470 code TEXT PRIMARY KEY,
474 CREATE TABLE config.bib_level_map (
475 code TEXT PRIMARY KEY,
479 CREATE TABLE config.z3950_source (
480 name TEXT PRIMARY KEY,
481 label TEXT NOT NULL UNIQUE,
485 record_format TEXT NOT NULL DEFAULT 'FI',
486 transmission_format TEXT NOT NULL DEFAULT 'usmarc',
487 auth BOOL NOT NULL DEFAULT TRUE
490 CREATE TABLE config.z3950_attr (
491 id SERIAL PRIMARY KEY,
492 source TEXT NOT NULL REFERENCES config.z3950_source (name) DEFERRABLE INITIALLY DEFERRED,
497 truncation INT NOT NULL DEFAULT 0,
498 CONSTRAINT z_code_format_once_per_source UNIQUE (code,format,source)
501 CREATE TABLE config.i18n_locale (
502 code TEXT PRIMARY KEY,
503 marc_code TEXT NOT NULL REFERENCES config.language_map (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
504 name TEXT UNIQUE NOT NULL,
508 CREATE TABLE config.i18n_core (
509 id BIGSERIAL PRIMARY KEY,
510 fq_field TEXT NOT NULL,
511 identity_value TEXT NOT NULL,
512 translation TEXT NOT NULL REFERENCES config.i18n_locale (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
516 CREATE UNIQUE INDEX i18n_identity ON config.i18n_core (fq_field,identity_value,translation);
518 CREATE TABLE config.billing_type (
519 id SERIAL PRIMARY KEY,
521 owner INT NOT NULL, -- REFERENCES actor.org_unit (id)
522 default_price NUMERIC(6,2),
523 CONSTRAINT billing_type_once_per_lib UNIQUE (name, owner)