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 'mods',
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
250 COMMENT ON TABLE config.rule_max_fine IS $$
252 * Copyright (C) 2005 Georgia Public Library Service
253 * Mike Rylander <mrylander@gmail.com>
255 * Circulation Max Fine rules
257 * Each circulation is given a maximum fine based on one of
263 * This program is free software; you can redistribute it and/or
264 * modify it under the terms of the GNU General Public License
265 * as published by the Free Software Foundation; either version 2
266 * of the License, or (at your option) any later version.
268 * This program is distributed in the hope that it will be useful,
269 * but WITHOUT ANY WARRANTY; without even the implied warranty of
270 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
271 * GNU General Public License for more details.
275 CREATE TABLE config.rule_recuring_fine (
276 id SERIAL PRIMARY KEY,
277 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
278 high NUMERIC(6,2) NOT NULL,
279 normal NUMERIC(6,2) NOT NULL,
280 low NUMERIC(6,2) NOT NULL,
281 recurance_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL
283 COMMENT ON TABLE config.rule_recuring_fine IS $$
285 * Copyright (C) 2005 Georgia Public Library Service
286 * Mike Rylander <mrylander@gmail.com>
288 * Circulation Recurring Fine rules
290 * Each circulation is given a recurring fine amount based on one of
291 * these rules. The recurance_interval should not be any shorter
292 * than the interval between runs of the fine_processor.pl script
293 * (which is run from CRON), or you could miss fines.
298 * This program is free software; you can redistribute it and/or
299 * modify it under the terms of the GNU General Public License
300 * as published by the Free Software Foundation; either version 2
301 * of the License, or (at your option) any later version.
303 * This program is distributed in the hope that it will be useful,
304 * but WITHOUT ANY WARRANTY; without even the implied warranty of
305 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
306 * GNU General Public License for more details.
311 CREATE TABLE config.rule_age_hold_protect (
312 id SERIAL PRIMARY KEY,
313 name TEXT NOT NULL UNIQUE CHECK ( name ~ E'^\\w+$' ),
314 age INTERVAL NOT NULL,
317 COMMENT ON TABLE config.rule_age_hold_protect IS $$
319 * Copyright (C) 2005 Georgia Public Library Service
320 * Mike Rylander <mrylander@gmail.com>
322 * Hold Item Age Protection rules
324 * A hold request can only capture new(ish) items when they are
325 * within a particular proximity of the home_ou of the requesting
326 * user. The proximity ('prox' column) is calculated by counting
327 * the number of tree edges between the user's home_ou and the owning_lib
328 * of the copy that could fulfill the hold.
333 * This program is free software; you can redistribute it and/or
334 * modify it under the terms of the GNU General Public License
335 * as published by the Free Software Foundation; either version 2
336 * of the License, or (at your option) any later version.
338 * This program is distributed in the hope that it will be useful,
339 * but WITHOUT ANY WARRANTY; without even the implied warranty of
340 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
341 * GNU General Public License for more details.
345 CREATE TABLE config.copy_status (
346 id SERIAL PRIMARY KEY,
347 name TEXT NOT NULL UNIQUE,
348 holdable BOOL NOT NULL DEFAULT FALSE,
349 opac_visible BOOL NOT NULL DEFAULT FALSE
351 COMMENT ON TABLE config.copy_status IS $$
353 * Copyright (C) 2005 Georgia Public Library Service
354 * Mike Rylander <mrylander@gmail.com>
358 * The available copy statuses, and whether a copy in that
359 * status is available for hold request capture. 0 (zero) is
360 * the only special number in this set, meaning that the item
361 * is available for immediate checkout, and is counted as available
364 * Statuses with an ID below 100 are not removable, and have special
365 * meaning in the code. Do not change them except to translate the
368 * You may add and remove statuses above 100, and these can be used
369 * to remove items from normal circulation without affecting the rest
370 * of the copy's values or its location.
374 * This program is free software; you can redistribute it and/or
375 * modify it under the terms of the GNU General Public License
376 * as published by the Free Software Foundation; either version 2
377 * of the License, or (at your option) any later version.
379 * This program is distributed in the hope that it will be useful,
380 * but WITHOUT ANY WARRANTY; without even the implied warranty of
381 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
382 * GNU General Public License for more details.
386 CREATE TABLE config.net_access_level (
387 id SERIAL PRIMARY KEY,
388 name TEXT NOT NULL UNIQUE
390 COMMENT ON TABLE config.net_access_level IS $$
392 * Copyright (C) 2005 Georgia Public Library Service
393 * Mike Rylander <mrylander@gmail.com>
395 * Patron Network Access level
397 * This will be used to inform the in-library firewall of how much
398 * internet access the using patron should be allowed.
402 * This program is free software; you can redistribute it and/or
403 * modify it under the terms of the GNU General Public License
404 * as published by the Free Software Foundation; either version 2
405 * of the License, or (at your option) any later version.
407 * This program is distributed in the hope that it will be useful,
408 * but WITHOUT ANY WARRANTY; without even the implied warranty of
409 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
410 * GNU General Public License for more details.
414 CREATE TABLE config.audience_map (
415 code TEXT PRIMARY KEY,
420 CREATE TABLE config.lit_form_map (
421 code TEXT PRIMARY KEY,
426 CREATE TABLE config.language_map (
427 code TEXT PRIMARY KEY,
431 CREATE TABLE config.item_form_map (
432 code TEXT PRIMARY KEY,
436 CREATE TABLE config.item_type_map (
437 code TEXT PRIMARY KEY,
441 CREATE TABLE config.bib_level_map (
442 code TEXT PRIMARY KEY,
446 CREATE TABLE config.i18n_locale (
447 code TEXT PRIMARY KEY,
448 marc_code TEXT NOT NULL REFERENCES config.language_map (code),
449 name TEXT UNIQUE NOT NULL,
453 CREATE TABLE config.i18n_core (
454 id BIGSERIAL PRIMARY KEY,
455 fq_field TEXT NOT NULL,
456 identity_value TEXT NOT NULL,
457 translation TEXT NOT NULL REFERENCES config.i18n_locale (code),
461 CREATE UNIQUE INDEX i18n_identity ON config.i18n_core (fq_field,identity_value,translation);