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 SELECT SETVAL('config.standing_penalty_id_seq', 100);
128 CREATE TABLE config.xml_transform (
129 name TEXT PRIMARY KEY,
130 namespace_uri TEXT NOT NULL,
131 prefix TEXT NOT NULL,
135 CREATE TABLE config.metabib_field (
136 id SERIAL PRIMARY KEY,
137 field_class TEXT NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
140 weight INT NOT NULL DEFAULT 1,
141 format TEXT NOT NULL DEFAULT 'mods32',
142 search_field BOOL NOT NULL DEFAULT TRUE,
143 facet_field BOOL NOT NULL DEFAULT FALSE
145 COMMENT ON TABLE config.metabib_field IS $$
147 * Copyright (C) 2005 Georgia Public Library Service
148 * Mike Rylander <mrylander@gmail.com>
150 * XPath used for record indexing ingest
152 * This table contains the XPath used to chop up MODS into its
153 * indexable parts. Each XPath entry is named and assigned to
154 * a "class" of either title, subject, author, keyword or series.
159 * This program is free software; you can redistribute it and/or
160 * modify it under the terms of the GNU General Public License
161 * as published by the Free Software Foundation; either version 2
162 * of the License, or (at your option) any later version.
164 * This program is distributed in the hope that it will be useful,
165 * but WITHOUT ANY WARRANTY; without even the implied warranty of
166 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
167 * GNU General Public License for more details.
171 CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
173 CREATE TABLE config.non_cataloged_type (
174 id SERIAL PRIMARY KEY,
175 owning_lib INT NOT NULL, -- REFERENCES actor.org_unit (id),
177 circ_duration INTERVAL NOT NULL DEFAULT '14 days'::INTERVAL,
178 in_house BOOL NOT NULL DEFAULT FALSE,
179 CONSTRAINT noncat_once_per_lib UNIQUE (owning_lib,name)
181 COMMENT ON TABLE config.non_cataloged_type IS $$
183 * Copyright (C) 2005 Georgia Public Library Service
184 * Mike Rylander <mrylander@gmail.com>
186 * Types of valid non-cataloged items.
191 * This program is free software; you can redistribute it and/or
192 * modify it under the terms of the GNU General Public License
193 * as published by the Free Software Foundation; either version 2
194 * of the License, or (at your option) any later version.
196 * This program is distributed in the hope that it will be useful,
197 * but WITHOUT ANY WARRANTY; without even the implied warranty of
198 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
199 * GNU General Public License for more details.
203 CREATE TABLE config.identification_type (
204 id SERIAL PRIMARY KEY,
205 name TEXT NOT NULL UNIQUE
207 COMMENT ON TABLE config.identification_type IS $$
209 * Copyright (C) 2005 Georgia Public Library Service
210 * Mike Rylander <mrylander@gmail.com>
212 * Types of valid patron identification.
214 * Each patron must display at least one valid form of identification
215 * in order to get a library card. This table lists those forms.
220 * This program is free software; you can redistribute it and/or
221 * modify it under the terms of the GNU General Public License
222 * as published by the Free Software Foundation; either version 2
223 * of the License, or (at your option) any later version.
225 * This program is distributed in the hope that it will be useful,
226 * but WITHOUT ANY WARRANTY; without even the implied warranty of
227 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
228 * GNU General Public License for more details.
232 CREATE TABLE config.rule_circ_duration (
233 id SERIAL PRIMARY KEY,
234 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
235 extended INTERVAL NOT NULL,
236 normal INTERVAL NOT NULL,
237 shrt INTERVAL NOT NULL,
238 max_renewals INT NOT NULL
240 COMMENT ON TABLE config.rule_circ_duration IS $$
242 * Copyright (C) 2005 Georgia Public Library Service
243 * Mike Rylander <mrylander@gmail.com>
245 * Circulation Duration rules
247 * Each circulation is given a duration based on one of these rules.
252 * This program is free software; you can redistribute it and/or
253 * modify it under the terms of the GNU General Public License
254 * as published by the Free Software Foundation; either version 2
255 * of the License, or (at your option) any later version.
257 * This program is distributed in the hope that it will be useful,
258 * but WITHOUT ANY WARRANTY; without even the implied warranty of
259 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
260 * GNU General Public License for more details.
264 CREATE TABLE config.rule_max_fine (
265 id SERIAL PRIMARY KEY,
266 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
267 amount NUMERIC(6,2) NOT NULL,
268 is_percent BOOL NOT NULL DEFAULT FALSE
270 COMMENT ON TABLE config.rule_max_fine IS $$
272 * Copyright (C) 2005 Georgia Public Library Service
273 * Mike Rylander <mrylander@gmail.com>
275 * Circulation Max Fine rules
277 * Each circulation is given a maximum fine based on one of
283 * This program is free software; you can redistribute it and/or
284 * modify it under the terms of the GNU General Public License
285 * as published by the Free Software Foundation; either version 2
286 * of the License, or (at your option) any later version.
288 * This program is distributed in the hope that it will be useful,
289 * but WITHOUT ANY WARRANTY; without even the implied warranty of
290 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
291 * GNU General Public License for more details.
295 CREATE TABLE config.rule_recuring_fine (
296 id SERIAL PRIMARY KEY,
297 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
298 high NUMERIC(6,2) NOT NULL,
299 normal NUMERIC(6,2) NOT NULL,
300 low NUMERIC(6,2) NOT NULL,
301 recurance_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL
303 COMMENT ON TABLE config.rule_recuring_fine IS $$
305 * Copyright (C) 2005 Georgia Public Library Service
306 * Mike Rylander <mrylander@gmail.com>
308 * Circulation Recurring Fine rules
310 * Each circulation is given a recurring fine amount based on one of
311 * these rules. The recurance_interval should not be any shorter
312 * than the interval between runs of the fine_processor.pl script
313 * (which is run from CRON), or you could miss fines.
318 * This program is free software; you can redistribute it and/or
319 * modify it under the terms of the GNU General Public License
320 * as published by the Free Software Foundation; either version 2
321 * of the License, or (at your option) any later version.
323 * This program is distributed in the hope that it will be useful,
324 * but WITHOUT ANY WARRANTY; without even the implied warranty of
325 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
326 * GNU General Public License for more details.
331 CREATE TABLE config.rule_age_hold_protect (
332 id SERIAL PRIMARY KEY,
333 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
334 age INTERVAL NOT NULL,
337 COMMENT ON TABLE config.rule_age_hold_protect IS $$
339 * Copyright (C) 2005 Georgia Public Library Service
340 * Mike Rylander <mrylander@gmail.com>
342 * Hold Item Age Protection rules
344 * A hold request can only capture new(ish) items when they are
345 * within a particular proximity of the home_ou of the requesting
346 * user. The proximity ('prox' column) is calculated by counting
347 * the number of tree edges between the user's home_ou and the owning_lib
348 * of the copy that could fulfill the hold.
353 * This program is free software; you can redistribute it and/or
354 * modify it under the terms of the GNU General Public License
355 * as published by the Free Software Foundation; either version 2
356 * of the License, or (at your option) any later version.
358 * This program is distributed in the hope that it will be useful,
359 * but WITHOUT ANY WARRANTY; without even the implied warranty of
360 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
361 * GNU General Public License for more details.
365 CREATE TABLE config.copy_status (
366 id SERIAL PRIMARY KEY,
367 name TEXT NOT NULL UNIQUE,
368 holdable BOOL NOT NULL DEFAULT FALSE,
369 opac_visible BOOL NOT NULL DEFAULT FALSE
371 COMMENT ON TABLE config.copy_status IS $$
373 * Copyright (C) 2005 Georgia Public Library Service
374 * Mike Rylander <mrylander@gmail.com>
378 * The available copy statuses, and whether a copy in that
379 * status is available for hold request capture. 0 (zero) is
380 * the only special number in this set, meaning that the item
381 * is available for immediate checkout, and is counted as available
384 * Statuses with an ID below 100 are not removable, and have special
385 * meaning in the code. Do not change them except to translate the
388 * You may add and remove statuses above 100, and these can be used
389 * to remove items from normal circulation without affecting the rest
390 * of the copy's values or its location.
394 * This program is free software; you can redistribute it and/or
395 * modify it under the terms of the GNU General Public License
396 * as published by the Free Software Foundation; either version 2
397 * of the License, or (at your option) any later version.
399 * This program is distributed in the hope that it will be useful,
400 * but WITHOUT ANY WARRANTY; without even the implied warranty of
401 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
402 * GNU General Public License for more details.
406 CREATE TABLE config.net_access_level (
407 id SERIAL PRIMARY KEY,
408 name TEXT NOT NULL UNIQUE
410 COMMENT ON TABLE config.net_access_level IS $$
412 * Copyright (C) 2005 Georgia Public Library Service
413 * Mike Rylander <mrylander@gmail.com>
415 * Patron Network Access level
417 * This will be used to inform the in-library firewall of how much
418 * internet access the using patron should be allowed.
422 * This program is free software; you can redistribute it and/or
423 * modify it under the terms of the GNU General Public License
424 * as published by the Free Software Foundation; either version 2
425 * of the License, or (at your option) any later version.
427 * This program is distributed in the hope that it will be useful,
428 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
430 * GNU General Public License for more details.
434 CREATE TABLE config.audience_map (
435 code TEXT PRIMARY KEY,
440 CREATE TABLE config.lit_form_map (
441 code TEXT PRIMARY KEY,
446 CREATE TABLE config.language_map (
447 code TEXT PRIMARY KEY,
451 CREATE TABLE config.item_form_map (
452 code TEXT PRIMARY KEY,
456 CREATE TABLE config.item_type_map (
457 code TEXT PRIMARY KEY,
461 CREATE TABLE config.bib_level_map (
462 code TEXT PRIMARY KEY,
466 CREATE TABLE config.z3950_source (
467 name TEXT PRIMARY KEY,
468 label TEXT NOT NULL UNIQUE,
472 record_format TEXT NOT NULL DEFAULT 'FI',
473 transmission_format TEXT NOT NULL DEFAULT 'usmarc',
474 auth BOOL NOT NULL DEFAULT TRUE
477 CREATE TABLE config.z3950_attr (
478 id SERIAL PRIMARY KEY,
479 source TEXT NOT NULL REFERENCES config.z3950_source (name),
484 truncation INT NOT NULL DEFAULT 0,
485 CONSTRAINT z_code_format_once_per_source UNIQUE (code,format,source)
488 CREATE TABLE config.i18n_locale (
489 code TEXT PRIMARY KEY,
490 marc_code TEXT NOT NULL REFERENCES config.language_map (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
491 name TEXT UNIQUE NOT NULL,
495 CREATE TABLE config.i18n_core (
496 id BIGSERIAL PRIMARY KEY,
497 fq_field TEXT NOT NULL,
498 identity_value TEXT NOT NULL,
499 translation TEXT NOT NULL REFERENCES config.i18n_locale (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
503 CREATE UNIQUE INDEX i18n_identity ON config.i18n_core (fq_field,identity_value,translation);
505 CREATE TABLE config.billing_type (
506 id SERIAL PRIMARY KEY,
508 owner INT NOT NULL, -- REFERENCES actor.org_unit (id)
509 default_price NUMERIC(6,2),
510 CONSTRAINT billing_type_once_per_lib UNIQUE (name, owner)