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