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.bib_source (
50 id SERIAL PRIMARY KEY,
51 quality INT CHECK ( quality BETWEEN 0 AND 100 ),
52 source TEXT NOT NULL UNIQUE,
53 transcendant BOOL NOT NULL DEFAULT FALSE
55 COMMENT ON TABLE config.bib_source IS $$
57 * Copyright (C) 2005 Georgia Public Library Service
58 * Mike Rylander <mrylander@gmail.com>
60 * Valid sources of MARC records
62 * This is table is used to set up the relative "quality" of each
63 * MARC source, such as OCLC.
67 * This program is free software; you can redistribute it and/or
68 * modify it under the terms of the GNU General Public License
69 * as published by the Free Software Foundation; either version 2
70 * of the License, or (at your option) any later version.
72 * This program is distributed in the hope that it will be useful,
73 * but WITHOUT ANY WARRANTY; without even the implied warranty of
74 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75 * GNU General Public License for more details.
79 CREATE TABLE config.standing (
80 id SERIAL PRIMARY KEY,
81 value TEXT NOT NULL UNIQUE
83 COMMENT ON TABLE config.standing IS $$
85 * Copyright (C) 2005 Georgia Public Library Service
86 * Mike Rylander <mrylander@gmail.com>
90 * This table contains the values that can be applied to a patron
91 * by a staff member. These values should not be changed, other
92 * than for translation, as the ID column is currently a "magic
93 * number" in the source. :(
97 * This program is free software; you can redistribute it and/or
98 * modify it under the terms of the GNU General Public License
99 * as published by the Free Software Foundation; either version 2
100 * of the License, or (at your option) any later version.
102 * This program is distributed in the hope that it will be useful,
103 * but WITHOUT ANY WARRANTY; without even the implied warranty of
104 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
105 * GNU General Public License for more details.
109 CREATE TABLE config.xml_transform (
110 name TEXT PRIMARY KEY,
111 namespace_uri TEXT NOT NULL,
112 prefix TEXT NOT NULL,
116 CREATE TABLE config.metabib_field (
117 id SERIAL PRIMARY KEY,
118 field_class TEXT NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
121 weight INT NOT NULL DEFAULT 1,
122 format TEXT NOT NULL DEFAULT 'mods32',
123 search_field BOOL NOT NULL DEFAULT TRUE,
124 facet_field BOOL NOT NULL DEFAULT FALSE
126 COMMENT ON TABLE config.metabib_field IS $$
128 * Copyright (C) 2005 Georgia Public Library Service
129 * Mike Rylander <mrylander@gmail.com>
131 * XPath used for record indexing ingest
133 * This table contains the XPath used to chop up MODS into its
134 * indexable parts. Each XPath entry is named and assigned to
135 * a "class" of either title, subject, author, keyword or series.
140 * This program is free software; you can redistribute it and/or
141 * modify it under the terms of the GNU General Public License
142 * as published by the Free Software Foundation; either version 2
143 * of the License, or (at your option) any later version.
145 * This program is distributed in the hope that it will be useful,
146 * but WITHOUT ANY WARRANTY; without even the implied warranty of
147 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148 * GNU General Public License for more details.
152 CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
154 CREATE TABLE config.non_cataloged_type (
155 id SERIAL PRIMARY KEY,
156 owning_lib INT NOT NULL, -- REFERENCES actor.org_unit (id),
158 circ_duration INTERVAL NOT NULL DEFAULT '14 days'::INTERVAL,
159 in_house BOOL NOT NULL DEFAULT FALSE,
160 CONSTRAINT noncat_once_per_lib UNIQUE (owning_lib,name)
162 COMMENT ON TABLE config.non_cataloged_type IS $$
164 * Copyright (C) 2005 Georgia Public Library Service
165 * Mike Rylander <mrylander@gmail.com>
167 * Types of valid non-cataloged items.
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 TABLE config.identification_type (
185 id SERIAL PRIMARY KEY,
186 name TEXT NOT NULL UNIQUE
188 COMMENT ON TABLE config.identification_type IS $$
190 * Copyright (C) 2005 Georgia Public Library Service
191 * Mike Rylander <mrylander@gmail.com>
193 * Types of valid patron identification.
195 * Each patron must display at least one valid form of identification
196 * in order to get a library card. This table lists those forms.
201 * This program is free software; you can redistribute it and/or
202 * modify it under the terms of the GNU General Public License
203 * as published by the Free Software Foundation; either version 2
204 * of the License, or (at your option) any later version.
206 * This program is distributed in the hope that it will be useful,
207 * but WITHOUT ANY WARRANTY; without even the implied warranty of
208 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
209 * GNU General Public License for more details.
213 CREATE TABLE config.rule_circ_duration (
214 id SERIAL PRIMARY KEY,
215 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
216 extended INTERVAL NOT NULL,
217 normal INTERVAL NOT NULL,
218 shrt INTERVAL NOT NULL,
219 max_renewals INT NOT NULL
221 COMMENT ON TABLE config.rule_circ_duration IS $$
223 * Copyright (C) 2005 Georgia Public Library Service
224 * Mike Rylander <mrylander@gmail.com>
226 * Circulation Duration rules
228 * Each circulation is given a duration based on one of these rules.
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_max_fine (
246 id SERIAL PRIMARY KEY,
247 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
248 amount NUMERIC(6,2) NOT NULL,
249 is_percent BOOL NOT NULL DEFAULT FALSE
251 COMMENT ON TABLE config.rule_max_fine IS $$
253 * Copyright (C) 2005 Georgia Public Library Service
254 * Mike Rylander <mrylander@gmail.com>
256 * Circulation Max Fine rules
258 * Each circulation is given a maximum fine based on one of
264 * This program is free software; you can redistribute it and/or
265 * modify it under the terms of the GNU General Public License
266 * as published by the Free Software Foundation; either version 2
267 * of the License, or (at your option) any later version.
269 * This program is distributed in the hope that it will be useful,
270 * but WITHOUT ANY WARRANTY; without even the implied warranty of
271 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
272 * GNU General Public License for more details.
276 CREATE TABLE config.rule_recuring_fine (
277 id SERIAL PRIMARY KEY,
278 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
279 high NUMERIC(6,2) NOT NULL,
280 normal NUMERIC(6,2) NOT NULL,
281 low NUMERIC(6,2) NOT NULL,
282 recurance_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL
284 COMMENT ON TABLE config.rule_recuring_fine IS $$
286 * Copyright (C) 2005 Georgia Public Library Service
287 * Mike Rylander <mrylander@gmail.com>
289 * Circulation Recurring Fine rules
291 * Each circulation is given a recurring fine amount based on one of
292 * these rules. The recurance_interval should not be any shorter
293 * than the interval between runs of the fine_processor.pl script
294 * (which is run from CRON), or you could miss fines.
299 * This program is free software; you can redistribute it and/or
300 * modify it under the terms of the GNU General Public License
301 * as published by the Free Software Foundation; either version 2
302 * of the License, or (at your option) any later version.
304 * This program is distributed in the hope that it will be useful,
305 * but WITHOUT ANY WARRANTY; without even the implied warranty of
306 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
307 * GNU General Public License for more details.
312 CREATE TABLE config.rule_age_hold_protect (
313 id SERIAL PRIMARY KEY,
314 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
315 age INTERVAL NOT NULL,
318 COMMENT ON TABLE config.rule_age_hold_protect IS $$
320 * Copyright (C) 2005 Georgia Public Library Service
321 * Mike Rylander <mrylander@gmail.com>
323 * Hold Item Age Protection rules
325 * A hold request can only capture new(ish) items when they are
326 * within a particular proximity of the home_ou of the requesting
327 * user. The proximity ('prox' column) is calculated by counting
328 * the number of tree edges between the user's home_ou and the owning_lib
329 * of the copy that could fulfill the hold.
334 * This program is free software; you can redistribute it and/or
335 * modify it under the terms of the GNU General Public License
336 * as published by the Free Software Foundation; either version 2
337 * of the License, or (at your option) any later version.
339 * This program is distributed in the hope that it will be useful,
340 * but WITHOUT ANY WARRANTY; without even the implied warranty of
341 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
342 * GNU General Public License for more details.
346 CREATE TABLE config.copy_status (
347 id SERIAL PRIMARY KEY,
348 name TEXT NOT NULL UNIQUE,
349 holdable BOOL NOT NULL DEFAULT FALSE,
350 opac_visible BOOL NOT NULL DEFAULT FALSE
352 COMMENT ON TABLE config.copy_status IS $$
354 * Copyright (C) 2005 Georgia Public Library Service
355 * Mike Rylander <mrylander@gmail.com>
359 * The available copy statuses, and whether a copy in that
360 * status is available for hold request capture. 0 (zero) is
361 * the only special number in this set, meaning that the item
362 * is available for immediate checkout, and is counted as available
365 * Statuses with an ID below 100 are not removable, and have special
366 * meaning in the code. Do not change them except to translate the
369 * You may add and remove statuses above 100, and these can be used
370 * to remove items from normal circulation without affecting the rest
371 * of the copy's values or its location.
375 * This program is free software; you can redistribute it and/or
376 * modify it under the terms of the GNU General Public License
377 * as published by the Free Software Foundation; either version 2
378 * of the License, or (at your option) any later version.
380 * This program is distributed in the hope that it will be useful,
381 * but WITHOUT ANY WARRANTY; without even the implied warranty of
382 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
383 * GNU General Public License for more details.
387 CREATE TABLE config.net_access_level (
388 id SERIAL PRIMARY KEY,
389 name TEXT NOT NULL UNIQUE
391 COMMENT ON TABLE config.net_access_level IS $$
393 * Copyright (C) 2005 Georgia Public Library Service
394 * Mike Rylander <mrylander@gmail.com>
396 * Patron Network Access level
398 * This will be used to inform the in-library firewall of how much
399 * internet access the using patron should be allowed.
403 * This program is free software; you can redistribute it and/or
404 * modify it under the terms of the GNU General Public License
405 * as published by the Free Software Foundation; either version 2
406 * of the License, or (at your option) any later version.
408 * This program is distributed in the hope that it will be useful,
409 * but WITHOUT ANY WARRANTY; without even the implied warranty of
410 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
411 * GNU General Public License for more details.
415 CREATE TABLE config.audience_map (
416 code TEXT PRIMARY KEY,
421 CREATE TABLE config.lit_form_map (
422 code TEXT PRIMARY KEY,
427 CREATE TABLE config.language_map (
428 code TEXT PRIMARY KEY,
432 CREATE TABLE config.item_form_map (
433 code TEXT PRIMARY KEY,
437 CREATE TABLE config.item_type_map (
438 code TEXT PRIMARY KEY,
442 CREATE TABLE config.bib_level_map (
443 code TEXT PRIMARY KEY,
447 CREATE TABLE config.z3950_source (
448 name TEXT PRIMARY KEY,
449 label TEXT NOT NULL UNIQUE,
453 record_format TEXT NOT NULL DEFAULT 'FI',
454 transmission_format TEXT NOT NULL DEFAULT 'usmarc',
455 auth BOOL NOT NULL DEFAULT TRUE
458 CREATE TABLE config.z3950_attr (
459 id SERIAL PRIMARY KEY,
460 source TEXT NOT NULL REFERENCES config.z3950_source (name),
465 truncation INT NOT NULL DEFAULT 0,
466 CONSTRAINT z_code_format_once_per_source UNIQUE (code,format,source)
469 CREATE TABLE config.i18n_locale (
470 code TEXT PRIMARY KEY,
471 marc_code TEXT NOT NULL REFERENCES config.language_map (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
472 name TEXT UNIQUE NOT NULL,
476 CREATE TABLE config.i18n_core (
477 id BIGSERIAL PRIMARY KEY,
478 fq_field TEXT NOT NULL,
479 identity_value TEXT NOT NULL,
480 translation TEXT NOT NULL REFERENCES config.i18n_locale (code) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
484 CREATE UNIQUE INDEX i18n_identity ON config.i18n_core (fq_field,identity_value,translation);