]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/002.schema.config.sql
renameing clashing "search" field to "search_field"
[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
32 CREATE TABLE config.bib_source (
33         id              SERIAL  PRIMARY KEY,
34         quality         INT     CHECK ( quality BETWEEN 0 AND 100 ),
35         source          TEXT    NOT NULL UNIQUE,
36         transcendant    BOOL    NOT NULL DEFAULT FALSE
37 );
38 COMMENT ON TABLE config.bib_source IS $$
39 /*
40  * Copyright (C) 2005  Georgia Public Library Service 
41  * Mike Rylander <mrylander@gmail.com>
42  *
43  * Valid sources of MARC records
44  *
45  * This is table is used to set up the relative "quality" of each
46  * MARC source, such as OCLC.
47  *
48  * ****
49  *
50  * This program is free software; you can redistribute it and/or
51  * modify it under the terms of the GNU General Public License
52  * as published by the Free Software Foundation; either version 2
53  * of the License, or (at your option) any later version.
54  *
55  * This program is distributed in the hope that it will be useful,
56  * but WITHOUT ANY WARRANTY; without even the implied warranty of
57  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
58  * GNU General Public License for more details.
59  */
60 $$;
61
62
63 INSERT INTO config.bib_source (quality, source) VALUES (90, 'oclc');
64 INSERT INTO config.bib_source (quality, source) VALUES (10, 'System Local');
65 INSERT INTO config.bib_source (quality, source, transcendant) VALUES (1, 'Project Gutenberg', TRUE);
66
67 CREATE TABLE config.standing (
68         id              SERIAL  PRIMARY KEY,
69         value           TEXT    NOT NULL UNIQUE
70 );
71 COMMENT ON TABLE config.standing IS $$
72 /*
73  * Copyright (C) 2005  Georgia Public Library Service 
74  * Mike Rylander <mrylander@gmail.com>
75  *
76  * Patron Standings
77  *
78  * This table contains the values that can be applied to a patron
79  * by a staff member.  These values should not be changed, other
80  * that for translation, as the ID column is currently a "magic
81  * number" in the source. :(
82  *
83  * ****
84  *
85  * This program is free software; you can redistribute it and/or
86  * modify it under the terms of the GNU General Public License
87  * as published by the Free Software Foundation; either version 2
88  * of the License, or (at your option) any later version.
89  *
90  * This program is distributed in the hope that it will be useful,
91  * but WITHOUT ANY WARRANTY; without even the implied warranty of
92  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
93  * GNU General Public License for more details.
94  */
95 $$;
96
97 INSERT INTO config.standing (value) VALUES ('Good');
98 INSERT INTO config.standing (value) VALUES ('Barred');
99
100
101 CREATE TABLE config.xml_transform (
102         name            TEXT    PRIMARY KEY,
103         namespace_uri   TEXT    NOT NULL UNIQUE,
104         prefix          TEXT    NOT NULL,
105         xslt            TEXT    NOT NULL
106 );
107 INSERT INTO config.xml_transform VALUES ( 'marcxml', 'http://www.loc.gov/MARC21/slim', 'marc', '---' );
108 INSERT INTO config.xml_transform VALUES ( 'mods', 'http://www.loc.gov/mods/', 'mods', '/home/miker/MARC21slim2MODS.xsl' );
109
110 CREATE TABLE config.metabib_field (
111         id              SERIAL  PRIMARY KEY,
112         field_class     TEXT    NOT NULL CHECK (lower(field_class) IN ('title','author','subject','keyword','series')),
113         name            TEXT    NOT NULL,
114         xpath           TEXT    NOT NULL,
115         weight          INT     NOT NULL DEFAULT 1,
116         format          TEXT    NOT NULL DEFAULT 'mods',
117         search_field    BOOL    NOT NULL DEFAULT TRUE,
118         facet_field     BOOL    NOT NULL DEFAULT FALSE
119 );
120 COMMENT ON TABLE config.metabib_field IS $$
121 /*
122  * Copyright (C) 2005  Georgia Public Library Service 
123  * Mike Rylander <mrylander@gmail.com>
124  *
125  * XPath used for WoRMing
126  *
127  * This table contains the XPath used to chop up MODS into it's
128  * indexable parts.  Each XPath entry is named and assigned to
129  * a "class" of either title, subject, author, keyword or series.
130  * 
131  *
132  * ****
133  *
134  * This program is free software; you can redistribute it and/or
135  * modify it under the terms of the GNU General Public License
136  * as published by the Free Software Foundation; either version 2
137  * of the License, or (at your option) any later version.
138  *
139  * This program is distributed in the hope that it will be useful,
140  * but WITHOUT ANY WARRANTY; without even the implied warranty of
141  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142  * GNU General Public License for more details.
143  */
144 $$;
145
146 CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
147
148
149 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'series', 'seriestitle', $$//mods:mods/mods:relatedItem[@type="series"]/mods:titleInfo$$ );
150 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'abbreviated', $$//mods:mods/mods:titleInfo[mods:title and (@type='abreviated')]$$ );
151 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'translated', $$//mods:mods/mods:titleInfo[mods:title and (@type='translated')]$$ );
152 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'uniform', $$//mods:mods/mods:titleInfo[mods:title and (@type='uniform')]$$ );
153 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'title', 'proper', $$//mods:mods/mods:titleInfo[mods:title and not (@type)]$$ );
154 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'corporate', $$//mods:mods/mods:name[@type='corporate']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
155 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'personal', $$//mods:mods/mods:name[@type='personal']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
156 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'conference', $$//mods:mods/mods:name[@type='conference']/mods:namePart[../mods:role/mods:text[text()='creator']]$$ );
157 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'author', 'other', $$//mods:mods/mods:name[@type='personal']/mods:namePart[not(../mods:role)]$$ );
158 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'geographic', $$//mods:mods/mods:subject/mods:geographic$$ );
159 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'name', $$//mods:mods/mods:subject/mods:name$$ );
160 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'temporal', $$//mods:mods/mods:subject/mods:temporal$$ );
161 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'topic', $$//mods:mods/mods:subject/mods:topic$$ );
162 -- INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'subject', 'genre', $$//mods:mods/mods:genre$$ );
163 INSERT INTO config.metabib_field ( field_class, name, xpath ) VALUES ( 'keyword', 'keyword', $$//mods:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */
164
165
166
167 CREATE OR REPLACE FUNCTION oils_xml_transform ( TEXT, TEXT ) RETURNS TEXT AS $_$
168         SELECT  CASE    WHEN (SELECT COUNT(*) FROM config.xml_transform WHERE name = $2 AND xslt = '---') > 0 THEN $1
169                         ELSE xslt_process($1, (SELECT xslt FROM config.xml_transform WHERE name = $2))
170                 END;
171 $_$ LANGUAGE SQL STRICT IMMUTABLE;
172
173
174
175 CREATE TYPE biblio_field_vtype AS ( record BIGINT, field INT, content TEXT );
176 CREATE OR REPLACE FUNCTION biblio_field_table ( record BIGINT, field_list INT[] ) RETURNS SETOF biblio_field_vtype AS $_$
177 DECLARE
178         i INT;
179         rec biblio_field_vtype%ROWTYPE;
180 BEGIN
181         FOR i IN ARRAY_LOWER(field_list,1) .. ARRAY_UPPER(field_list,1) LOOP
182                 FOR rec IN      SELECT  DISTINCT r, field_list[i], BTRIM(REGEXP_REPLACE(REGEXP_REPLACE(f, E'\n', ' ', 'g'), '[ ]+', ' ', 'g'))
183                                   FROM  xpath_table_ns(
184                                                 'id',
185                                                 $$oils_xml_transform(marc,'$$ || (SELECT format FROM config.metabib_field WHERE id = field_list[i]) || $$')$$,
186                                                 'biblio.record_entry',
187                                                 (SELECT xpath FROM config.metabib_field WHERE id = field_list[i]),
188                                                 'id = ' || record,
189                                                 (SELECT x.prefix FROM config.xml_transform x JOIN config.metabib_field m ON (m.format = x.name) WHERE m.id = field_list[i]),
190                                                 (SELECT x.namespace_uri FROM config.xml_transform x JOIN config.metabib_field m ON (m.format = x.name) WHERE m.id = field_list[i])
191                                         ) AS t( r bigint, f text)
192                                   WHERE f IS NOT NULL LOOP
193                         RETURN NEXT rec;
194                 END LOOP;
195         END LOOP;
196 END;
197 $_$ LANGUAGE PLPGSQL;
198
199
200
201 CREATE OR REPLACE FUNCTION biblio_field_table ( record BIGINT, field INT ) RETURNS SETOF biblio_field_vtype AS $_$
202         SELECT * FROM biblio_field_table( $1, ARRAY[$2] )
203 $_$ LANGUAGE SQL;
204
205
206
207 CREATE TABLE config.non_cataloged_type (
208         id              SERIAL          PRIMARY KEY,
209         owning_lib      INT             NOT NULL, -- REFERENCES actor.org_unit (id),
210         name            TEXT            NOT NULL,
211         circ_duration   INTERVAL        NOT NULL DEFAULT '14 days'::INTERVAL,
212         in_house        BOOL            NOT NULL DEFAULT FALSE,
213         CONSTRAINT noncat_once_per_lib UNIQUE (owning_lib,name)
214 );
215 COMMENT ON TABLE config.non_cataloged_type IS $$
216 /*
217  * Copyright (C) 2005  Georgia Public Library Service 
218  * Mike Rylander <mrylander@gmail.com>
219  *
220  * Types of valid non-cataloged items.
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
238 INSERT INTO config.non_cataloged_type ( owning_lib, name ) VALUES ( 1, 'Paperback Book' );
239
240 CREATE TABLE config.identification_type (
241         id              SERIAL  PRIMARY KEY,
242         name            TEXT    NOT NULL UNIQUE
243 );
244 COMMENT ON TABLE config.identification_type IS $$
245 /*
246  * Copyright (C) 2005  Georgia Public Library Service 
247  * Mike Rylander <mrylander@gmail.com>
248  *
249  * Types of valid patron identification.
250  *
251  * Each patron must display at least one valid form of identification
252  * in order to get a library card.  This table lists those forms.
253  * 
254  *
255  * ****
256  *
257  * This program is free software; you can redistribute it and/or
258  * modify it under the terms of the GNU General Public License
259  * as published by the Free Software Foundation; either version 2
260  * of the License, or (at your option) any later version.
261  *
262  * This program is distributed in the hope that it will be useful,
263  * but WITHOUT ANY WARRANTY; without even the implied warranty of
264  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
265  * GNU General Public License for more details.
266  */
267 $$;
268
269
270 INSERT INTO config.identification_type ( name ) VALUES ( 'Drivers License' );
271 INSERT INTO config.identification_type ( name ) VALUES ( 'SSN' );
272 INSERT INTO config.identification_type ( name ) VALUES ( 'Other' );
273
274 CREATE TABLE config.rule_circ_duration (
275         id              SERIAL          PRIMARY KEY,
276         name            TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
277         extended        INTERVAL        NOT NULL,
278         normal          INTERVAL        NOT NULL,
279         shrt            INTERVAL        NOT NULL,
280         max_renewals    INT             NOT NULL
281 );
282 COMMENT ON TABLE config.rule_circ_duration IS $$
283 /*
284  * Copyright (C) 2005  Georgia Public Library Service 
285  * Mike Rylander <mrylander@gmail.com>
286  *
287  * Circulation Duration rules
288  *
289  * Each circulation is given a duration based on one of these rules.
290  * 
291  *
292  * ****
293  *
294  * This program is free software; you can redistribute it and/or
295  * modify it under the terms of the GNU General Public License
296  * as published by the Free Software Foundation; either version 2
297  * of the License, or (at your option) any later version.
298  *
299  * This program is distributed in the hope that it will be useful,
300  * but WITHOUT ANY WARRANTY; without even the implied warranty of
301  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
302  * GNU General Public License for more details.
303  */
304 $$;
305
306 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '7_days_0_renew', '7 days', '7 days', '7 days', 0);
307 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '28_days_2_renew', '28 days', '28 days', '28 days', 2);
308 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '3_months_0_renew', '3 mons', '3 mons', '3 mons', 0);
309 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '3_days_1_renew', '3 days', '3 days', '3 days', 1);
310 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '2_months_2_renew', '2 mons', '2 mons', '2 mons', 2);
311 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '35_days_1_renew', '35 days', '35 days', '35 days', 1);
312 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '7_days_2_renew', '7 days', '7 days', '7 days', 2);
313 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '1_hour_2_renew', '1 hour', '1 hour', '1 hour', 2);
314 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '28_days_0_renew', '28 days', '28 days', '28 days', 0);
315 INSERT INTO config.rule_circ_duration VALUES (DEFAULT, '14_days_2_renew', '14 days', '14 days', '14 days', 2);
316
317
318 CREATE TABLE config.rule_max_fine (
319         id      SERIAL          PRIMARY KEY,
320         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
321         amount  NUMERIC(6,2)    NOT NULL
322 );
323 COMMENT ON TABLE config.rule_max_fine IS $$
324 /*
325  * Copyright (C) 2005  Georgia Public Library Service 
326  * Mike Rylander <mrylander@gmail.com>
327  *
328  * Circulation Max Fine rules
329  *
330  * Each circulation is given a maximum fine based on one of
331  * these rules.
332  * 
333  *
334  * ****
335  *
336  * This program is free software; you can redistribute it and/or
337  * modify it under the terms of the GNU General Public License
338  * as published by the Free Software Foundation; either version 2
339  * of the License, or (at your option) any later version.
340  *
341  * This program is distributed in the hope that it will be useful,
342  * but WITHOUT ANY WARRANTY; without even the implied warranty of
343  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
344  * GNU General Public License for more details.
345  */
346 $$;
347
348 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_min', 5.00);
349 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_mid', 10.00);
350 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_max', 100.00);
351 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_min', 25.00);
352 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_mid', 25.00);
353 INSERT INTO config.rule_max_fine VALUES (DEFAULT, 'overdue_equip_max', 100.00);
354
355
356 CREATE TABLE config.rule_recuring_fine (
357         id                      SERIAL          PRIMARY KEY,
358         name                    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
359         high                    NUMERIC(6,2)    NOT NULL,
360         normal                  NUMERIC(6,2)    NOT NULL,
361         low                     NUMERIC(6,2)    NOT NULL,
362         recurance_interval      INTERVAL        NOT NULL DEFAULT '1 day'::INTERVAL
363 );
364 COMMENT ON TABLE config.rule_recuring_fine IS $$
365 /*
366  * Copyright (C) 2005  Georgia Public Library Service 
367  * Mike Rylander <mrylander@gmail.com>
368  *
369  * Circulation Recuring Fine rules
370  *
371  * Each circulation is given a recuring fine amount based on one of
372  * these rules.  The recurance_interval should not be any shorter
373  * than the interval between runs of the fine_processor.pl script
374  * (which is run from CRON), or you could miss fines.
375  * 
376  *
377  * ****
378  *
379  * This program is free software; you can redistribute it and/or
380  * modify it under the terms of the GNU General Public License
381  * as published by the Free Software Foundation; either version 2
382  * of the License, or (at your option) any later version.
383  *
384  * This program is distributed in the hope that it will be useful,
385  * but WITHOUT ANY WARRANTY; without even the implied warranty of
386  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
387  * GNU General Public License for more details.
388  */
389 $$;
390
391 INSERT INTO config.rule_recuring_fine VALUES (DEFAULT, '10_cent_per_day', 0.50, 0.10, 0.10, '1 day');
392 INSERT INTO config.rule_recuring_fine VALUES (DEFAULT, '50_cent_per_day', 0.50, 0.50, 0.50, '1 day');
393
394
395 CREATE TABLE config.rule_age_hold_protect (
396         id      SERIAL          PRIMARY KEY,
397         name    TEXT            NOT NULL UNIQUE CHECK ( name ~ '^\\w+$' ),
398         age     INTERVAL        NOT NULL,
399         prox    INT             NOT NULL
400 );
401 COMMENT ON TABLE config.rule_age_hold_protect IS $$
402 /*
403  * Copyright (C) 2005  Georgia Public Library Service 
404  * Mike Rylander <mrylander@gmail.com>
405  *
406  * Hold Item Age Protection rules
407  *
408  * A hold request can only capture new(ish) items when they are
409  * within a particular proximity of the home_ou of the requesting
410  * user.  The proximity ('prox' column) is calculated by counting
411  * the number of tree edges beween the user's home_ou and the owning_lib
412  * of the copy that could fulfill the hold.
413  * 
414  *
415  * ****
416  *
417  * This program is free software; you can redistribute it and/or
418  * modify it under the terms of the GNU General Public License
419  * as published by the Free Software Foundation; either version 2
420  * of the License, or (at your option) any later version.
421  *
422  * This program is distributed in the hope that it will be useful,
423  * but WITHOUT ANY WARRANTY; without even the implied warranty of
424  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
425  * GNU General Public License for more details.
426  */
427 $$;
428
429 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '3month', '3 mons', 0);
430 INSERT INTO config.rule_age_hold_protect VALUES (DEFAULT, '6month', '6 mons', 2);
431
432
433 CREATE TABLE config.copy_status (
434         id              SERIAL  PRIMARY KEY,
435         name            TEXT    NOT NULL UNIQUE,
436         holdable        BOOL    NOT NULL DEFAULT FALSE
437 );
438 COMMENT ON TABLE config.copy_status IS $$
439 /*
440  * Copyright (C) 2005  Georgia Public Library Service 
441  * Mike Rylander <mrylander@gmail.com>
442  *
443  * Copy Statuses
444  *
445  * The available copy statuses, and whether a copy in that
446  * status is available for hold request capture.  0 (zero) is
447  * the only special number in this set, meaning that the item
448  * is available for imediate checkout, and is counted as available
449  * in the OPAC.
450  *
451  * Statuses with an ID below 100 are not removable, and have special
452  * meaning in the code.  Do not change them except to translate the
453  * textual name.
454  *
455  * You may add and remove statuses above 100, and these can be used
456  * to remove items from normal circulation without affecting the rest
457  * of the copy's values or it's location.
458  *
459  * ****
460  *
461  * This program is free software; you can redistribute it and/or
462  * modify it under the terms of the GNU General Public License
463  * as published by the Free Software Foundation; either version 2
464  * of the License, or (at your option) any later version.
465  *
466  * This program is distributed in the hope that it will be useful,
467  * but WITHOUT ANY WARRANTY; without even the implied warranty of
468  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
469  * GNU General Public License for more details.
470  */
471 $$;
472
473 INSERT INTO config.copy_status (id,name,holdable)       VALUES (0,'Available','t');
474 INSERT INTO config.copy_status (name,holdable)          VALUES ('Checked out','t');
475 INSERT INTO config.copy_status (name)                   VALUES ('Bindery');
476 INSERT INTO config.copy_status (name)                   VALUES ('Lost');
477 INSERT INTO config.copy_status (name)                   VALUES ('Missing');
478 INSERT INTO config.copy_status (name,holdable)          VALUES ('In process','t');
479 INSERT INTO config.copy_status (name,holdable)          VALUES ('In transit','t');
480 INSERT INTO config.copy_status (name,holdable)          VALUES ('Reshelving','t');
481 INSERT INTO config.copy_status (name,holdable)          VALUES ('On holds shelf','t');
482 INSERT INTO config.copy_status (name,holdable)          VALUES ('On order','t');
483 INSERT INTO config.copy_status (name)                   VALUES ('ILL');
484 INSERT INTO config.copy_status (name)                   VALUES ('Cataloging');
485 INSERT INTO config.copy_status (name)                   VALUES ('Reserves');
486 INSERT INTO config.copy_status (name)                   VALUES ('Discard/Weed');
487 INSERT INTO config.copy_status (name)                   VALUES ('Damaged');
488
489 SELECT SETVAL('config.copy_status_id_seq'::TEXT, 100);
490
491
492 CREATE TABLE config.net_access_level (
493         id      SERIAL          PRIMARY KEY,
494         name    TEXT            NOT NULL UNIQUE
495 );
496 COMMENT ON TABLE config.net_access_level IS $$
497 /*
498  * Copyright (C) 2005  Georgia Public Library Service 
499  * Mike Rylander <mrylander@gmail.com>
500  *
501  * Patron Network Access level
502  *
503  * This will be used to inform the in-library firewall of how much
504  * internet access the using patron should be allowed.
505  *
506  * ****
507  *
508  * This program is free software; you can redistribute it and/or
509  * modify it under the terms of the GNU General Public License
510  * as published by the Free Software Foundation; either version 2
511  * of the License, or (at your option) any later version.
512  *
513  * This program is distributed in the hope that it will be useful,
514  * but WITHOUT ANY WARRANTY; without even the implied warranty of
515  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
516  * GNU General Public License for more details.
517  */
518 $$;
519
520 INSERT INTO config.net_access_level (name) VALUES ('Filtered');
521 INSERT INTO config.net_access_level (name) VALUES ('Unfiltered');
522 INSERT INTO config.net_access_level (name) VALUES ('No Access');
523
524 CREATE TABLE config.audience_map (
525         code            TEXT    PRIMARY KEY,
526         value           TEXT    NOT NULL,
527         description     TEXT
528 );
529
530 COPY config.audience_map FROM STDIN;
531         Unknown or unspecified  The target audience for the item not known or not specified.
532 a       Preschool       The item is intended for children, approximate ages 0-5 years.
533 b       Primary The item is intended for children, approximate ages 6-8 years.
534 c       Pre-adolescent  The item is intended for young people, approximate ages 9-13 years.
535 d       Adolescent      The item is intended for young people, approximate ages 14-17 years.
536 e       Adult   The item is intended for adults.
537 f       Specialized     The item is aimed at a particular audience and the nature of the presentation makes the item of little interest to another audience.
538 g       General The item is of general interest and not aimed at an audience of a particular intellectual level.
539 j       Juvenile        The item is intended for children and young people, approximate ages 0-15 years.
540 \.
541
542
543 CREATE TABLE config.lit_form_map (
544         code            TEXT    PRIMARY KEY,
545         value           TEXT    NOT NULL,
546         description     TEXT
547 );
548
549 COPY config.lit_form_map FROM STDIN;
550 0       Not fiction (not further specified)     The item is not a work of fiction and no further identification of the literary form is desired
551 1       Fiction (not further specified) The item is a work of fiction and no further identification of the literary form is desired
552 c       Comic strips    \N
553 d       Dramas  \N
554 e       Essays  \N
555 f       Novels  \N
556 h       Humor, satires, etc.    The item is a humorous work, satire or of similar literary form.
557 i       Letters The item is a single letter or collection of correspondence.
558 j       Short stories   The item is a short story or collection of short stories.
559 m       Mixed forms     The item is a variety of literary forms (e.g., poetry and short stories).
560 p       Poetry  The item is a poem or collection of poems.
561 s       Speeches        The item is a speech or collection of speeches.
562 u       Unknown The literary form of the item is unknown.
563 \.
564
565 CREATE TABLE config.language_map (
566         code    TEXT    PRIMARY KEY,
567         value   TEXT    NOT NULL
568 );
569
570 COPY config.language_map FROM STDIN;
571 aar     Afar
572 abk     Abkhaz
573 ace     Achinese
574 ach     Acoli
575 ada     Adangme
576 ady     Adygei
577 afa     Afroasiatic (Other)
578 afh     Afrihili (Artificial language)
579 afr     Afrikaans
580 -ajm    Aljamía
581 aka     Akan
582 akk     Akkadian
583 alb     Albanian
584 ale     Aleut
585 alg     Algonquian (Other)
586 amh     Amharic
587 ang     English, Old (ca. 450-1100)
588 apa     Apache languages
589 ara     Arabic
590 arc     Aramaic
591 arg     Aragonese Spanish
592 arm     Armenian
593 arn     Mapuche
594 arp     Arapaho
595 art     Artificial (Other)
596 arw     Arawak
597 asm     Assamese
598 ast     Bable
599 ath     Athapascan (Other)
600 aus     Australian languages
601 ava     Avaric
602 ave     Avestan
603 awa     Awadhi
604 aym     Aymara
605 aze     Azerbaijani
606 bad     Banda
607 bai     Bamileke languages
608 bak     Bashkir
609 bal     Baluchi
610 bam     Bambara
611 ban     Balinese
612 baq     Basque
613 bas     Basa
614 bat     Baltic (Other)
615 bej     Beja
616 bel     Belarusian
617 bem     Bemba
618 ben     Bengali
619 ber     Berber (Other)
620 bho     Bhojpuri
621 bih     Bihari
622 bik     Bikol
623 bin     Edo
624 bis     Bislama
625 bla     Siksika
626 bnt     Bantu (Other)
627 bos     Bosnian
628 bra     Braj
629 bre     Breton
630 btk     Batak
631 bua     Buriat
632 bug     Bugis
633 bul     Bulgarian
634 bur     Burmese
635 cad     Caddo
636 cai     Central American Indian (Other)
637 -cam    Khmer
638 car     Carib
639 cat     Catalan
640 cau     Caucasian (Other)
641 ceb     Cebuano
642 cel     Celtic (Other)
643 cha     Chamorro
644 chb     Chibcha
645 che     Chechen
646 chg     Chagatai
647 chi     Chinese
648 chk     Truk
649 chm     Mari
650 chn     Chinook jargon
651 cho     Choctaw
652 chp     Chipewyan
653 chr     Cherokee
654 chu     Church Slavic
655 chv     Chuvash
656 chy     Cheyenne
657 cmc     Chamic languages
658 cop     Coptic
659 cor     Cornish
660 cos     Corsican
661 cpe     Creoles and Pidgins, English-based (Other)
662 cpf     Creoles and Pidgins, French-based (Other)
663 cpp     Creoles and Pidgins, Portuguese-based (Other)
664 cre     Cree
665 crh     Crimean Tatar
666 crp     Creoles and Pidgins (Other)
667 cus     Cushitic (Other)
668 cze     Czech
669 dak     Dakota
670 dan     Danish
671 dar     Dargwa
672 day     Dayak
673 del     Delaware
674 den     Slave
675 dgr     Dogrib
676 din     Dinka
677 div     Divehi
678 doi     Dogri
679 dra     Dravidian (Other)
680 dua     Duala
681 dum     Dutch, Middle (ca. 1050-1350)
682 dut     Dutch
683 dyu     Dyula
684 dzo     Dzongkha
685 efi     Efik
686 egy     Egyptian
687 eka     Ekajuk
688 elx     Elamite
689 eng     English
690 enm     English, Middle (1100-1500)
691 epo     Esperanto
692 -esk    Eskimo languages
693 -esp    Esperanto
694 est     Estonian
695 -eth    Ethiopic
696 ewe     Ewe
697 ewo     Ewondo
698 fan     Fang
699 fao     Faroese
700 -far    Faroese
701 fat     Fanti
702 fij     Fijian
703 fin     Finnish
704 fiu     Finno-Ugrian (Other)
705 fon     Fon
706 fre     French
707 -fri    Frisian
708 frm     French, Middle (ca. 1400-1600)
709 fro     French, Old (ca. 842-1400)
710 fry     Frisian
711 ful     Fula
712 fur     Friulian
713 gaa     Gã
714 -gae    Scottish Gaelic
715 -gag    Galician
716 -gal    Oromo
717 gay     Gayo
718 gba     Gbaya
719 gem     Germanic (Other)
720 geo     Georgian
721 ger     German
722 gez     Ethiopic
723 gil     Gilbertese
724 gla     Scottish Gaelic
725 gle     Irish
726 glg     Galician
727 glv     Manx
728 gmh     German, Middle High (ca. 1050-1500)
729 goh     German, Old High (ca. 750-1050)
730 gon     Gondi
731 gor     Gorontalo
732 got     Gothic
733 grb     Grebo
734 grc     Greek, Ancient (to 1453)
735 gre     Greek, Modern (1453- )
736 grn     Guarani
737 -gua    Guarani
738 guj     Gujarati
739 gwi     Gwich'in
740 hai     Haida
741 hat     Haitian French Creole
742 hau     Hausa
743 haw     Hawaiian
744 heb     Hebrew
745 her     Herero
746 hil     Hiligaynon
747 him     Himachali
748 hin     Hindi
749 hit     Hittite
750 hmn     Hmong
751 hmo     Hiri Motu
752 hun     Hungarian
753 hup     Hupa
754 iba     Iban
755 ibo     Igbo
756 ice     Icelandic
757 ido     Ido
758 iii     Sichuan Yi
759 ijo     Ijo
760 iku     Inuktitut
761 ile     Interlingue
762 ilo     Iloko
763 ina     Interlingua (International Auxiliary Language Association)
764 inc     Indic (Other)
765 ind     Indonesian
766 ine     Indo-European (Other)
767 inh     Ingush
768 -int    Interlingua (International Auxiliary Language Association)
769 ipk     Inupiaq
770 ira     Iranian (Other)
771 -iri    Irish
772 iro     Iroquoian (Other)
773 ita     Italian
774 jav     Javanese
775 jpn     Japanese
776 jpr     Judeo-Persian
777 jrb     Judeo-Arabic
778 kaa     Kara-Kalpak
779 kab     Kabyle
780 kac     Kachin
781 kal     Kalâtdlisut
782 kam     Kamba
783 kan     Kannada
784 kar     Karen
785 kas     Kashmiri
786 kau     Kanuri
787 kaw     Kawi
788 kaz     Kazakh
789 kbd     Kabardian
790 kha     Khasi
791 khi     Khoisan (Other)
792 khm     Khmer
793 kho     Khotanese
794 kik     Kikuyu
795 kin     Kinyarwanda
796 kir     Kyrgyz
797 kmb     Kimbundu
798 kok     Konkani
799 kom     Komi
800 kon     Kongo
801 kor     Korean
802 kos     Kusaie
803 kpe     Kpelle
804 kro     Kru
805 kru     Kurukh
806 kua     Kuanyama
807 kum     Kumyk
808 kur     Kurdish
809 -kus    Kusaie
810 kut     Kutenai
811 lad     Ladino
812 lah     Lahnda
813 lam     Lamba
814 -lan    Occitan (post-1500)
815 lao     Lao
816 -lap    Sami
817 lat     Latin
818 lav     Latvian
819 lez     Lezgian
820 lim     Limburgish
821 lin     Lingala
822 lit     Lithuanian
823 lol     Mongo-Nkundu
824 loz     Lozi
825 ltz     Letzeburgesch
826 lua     Luba-Lulua
827 lub     Luba-Katanga
828 lug     Ganda
829 lui     Luiseño
830 lun     Lunda
831 luo     Luo (Kenya and Tanzania)
832 lus     Lushai
833 mac     Macedonian
834 mad     Madurese
835 mag     Magahi
836 mah     Marshallese
837 mai     Maithili
838 mak     Makasar
839 mal     Malayalam
840 man     Mandingo
841 mao     Maori
842 map     Austronesian (Other)
843 mar     Marathi
844 mas     Masai
845 -max    Manx
846 may     Malay
847 mdr     Mandar
848 men     Mende
849 mga     Irish, Middle (ca. 1100-1550)
850 mic     Micmac
851 min     Minangkabau
852 mis     Miscellaneous languages
853 mkh     Mon-Khmer (Other)
854 -mla    Malagasy
855 mlg     Malagasy
856 mlt     Maltese
857 mnc     Manchu
858 mni     Manipuri
859 mno     Manobo languages
860 moh     Mohawk
861 mol     Moldavian
862 mon     Mongolian
863 mos     Mooré
864 mul     Multiple languages
865 mun     Munda (Other)
866 mus     Creek
867 mwr     Marwari
868 myn     Mayan languages
869 nah     Nahuatl
870 nai     North American Indian (Other)
871 nap     Neapolitan Italian
872 nau     Nauru
873 nav     Navajo
874 nbl     Ndebele (South Africa)
875 nde     Ndebele (Zimbabwe)  
876 ndo     Ndonga
877 nds     Low German
878 nep     Nepali
879 new     Newari
880 nia     Nias
881 nic     Niger-Kordofanian (Other)
882 niu     Niuean
883 nno     Norwegian (Nynorsk)
884 nob     Norwegian (Bokmål)
885 nog     Nogai
886 non     Old Norse
887 nor     Norwegian
888 nso     Northern Sotho
889 nub     Nubian languages
890 nya     Nyanja
891 nym     Nyamwezi
892 nyn     Nyankole
893 nyo     Nyoro
894 nzi     Nzima
895 oci     Occitan (post-1500)
896 oji     Ojibwa
897 ori     Oriya
898 orm     Oromo
899 osa     Osage
900 oss     Ossetic
901 ota     Turkish, Ottoman
902 oto     Otomian languages
903 paa     Papuan (Other)
904 pag     Pangasinan
905 pal     Pahlavi
906 pam     Pampanga
907 pan     Panjabi
908 pap     Papiamento
909 pau     Palauan
910 peo     Old Persian (ca. 600-400 B.C.)
911 per     Persian
912 phi     Philippine (Other)
913 phn     Phoenician
914 pli     Pali
915 pol     Polish
916 pon     Ponape
917 por     Portuguese
918 pra     Prakrit languages
919 pro     Provençal (to 1500)
920 pus     Pushto
921 que     Quechua
922 raj     Rajasthani
923 rap     Rapanui
924 rar     Rarotongan
925 roa     Romance (Other)
926 roh     Raeto-Romance
927 rom     Romani
928 rum     Romanian
929 run     Rundi
930 rus     Russian
931 sad     Sandawe
932 sag     Sango (Ubangi Creole)
933 sah     Yakut
934 sai     South American Indian (Other)
935 sal     Salishan languages
936 sam     Samaritan Aramaic
937 san     Sanskrit
938 -sao    Samoan
939 sas     Sasak
940 sat     Santali
941 scc     Serbian
942 sco     Scots
943 scr     Croatian
944 sel     Selkup
945 sem     Semitic (Other)
946 sga     Irish, Old (to 1100)
947 sgn     Sign languages
948 shn     Shan
949 -sho    Shona
950 sid     Sidamo
951 sin     Sinhalese
952 sio     Siouan (Other)
953 sit     Sino-Tibetan (Other)
954 sla     Slavic (Other)
955 slo     Slovak
956 slv     Slovenian
957 sma     Southern Sami
958 sme     Northern Sami
959 smi     Sami
960 smj     Lule Sami
961 smn     Inari Sami
962 smo     Samoan
963 sms     Skolt Sami
964 sna     Shona
965 snd     Sindhi
966 -snh    Sinhalese
967 snk     Soninke
968 sog     Sogdian
969 som     Somali
970 son     Songhai
971 sot     Sotho
972 spa     Spanish
973 srd     Sardinian
974 srr     Serer
975 ssa     Nilo-Saharan (Other)
976 -sso    Sotho
977 ssw     Swazi
978 suk     Sukuma
979 sun     Sundanese
980 sus     Susu
981 sux     Sumerian
982 swa     Swahili
983 swe     Swedish
984 -swz    Swazi
985 syr     Syriac
986 -tag    Tagalog
987 tah     Tahitian
988 tai     Tai (Other)
989 -taj    Tajik
990 tam     Tamil
991 -tar    Tatar
992 tat     Tatar
993 tel     Telugu
994 tem     Temne
995 ter     Terena
996 tet     Tetum
997 tgk     Tajik
998 tgl     Tagalog
999 tha     Thai
1000 tib     Tibetan
1001 tig     Tigré
1002 tir     Tigrinya
1003 tiv     Tiv
1004 tkl     Tokelauan
1005 tli     Tlingit
1006 tmh     Tamashek
1007 tog     Tonga (Nyasa)
1008 ton     Tongan
1009 tpi     Tok Pisin
1010 -tru    Truk
1011 tsi     Tsimshian
1012 tsn     Tswana
1013 tso     Tsonga
1014 -tsw    Tswana
1015 tuk     Turkmen
1016 tum     Tumbuka
1017 tup     Tupi languages
1018 tur     Turkish
1019 tut     Altaic (Other)
1020 tvl     Tuvaluan
1021 twi     Twi
1022 tyv     Tuvinian
1023 udm     Udmurt
1024 uga     Ugaritic
1025 uig     Uighur
1026 ukr     Ukrainian
1027 umb     Umbundu
1028 und     Undetermined
1029 urd     Urdu
1030 uzb     Uzbek
1031 vai     Vai
1032 ven     Venda
1033 vie     Vietnamese
1034 vol     Volapük
1035 vot     Votic
1036 wak     Wakashan languages
1037 wal     Walamo
1038 war     Waray
1039 was     Washo
1040 wel     Welsh
1041 wen     Sorbian languages
1042 wln     Walloon
1043 wol     Wolof
1044 xal     Kalmyk
1045 xho     Xhosa
1046 yao     Yao (Africa)
1047 yap     Yapese
1048 yid     Yiddish
1049 yor     Yoruba
1050 ypk     Yupik languages
1051 zap     Zapotec
1052 zen     Zenaga
1053 zha     Zhuang
1054 znd     Zande
1055 zul     Zulu
1056 zun     Zuni
1057 \.
1058
1059 CREATE TABLE config.item_form_map (
1060         code    TEXT    PRIMARY KEY,
1061         value   TEXT    NOT NULL
1062 );
1063
1064 COPY config.item_form_map FROM STDIN;
1065 a       Microfilm
1066 b       Microfiche
1067 c       Microopaque
1068 d       Large print
1069 f       Braille
1070 r       Regular print reproduction
1071 s       Electronic
1072 \.
1073
1074 CREATE TABLE config.item_type_map (
1075         code    TEXT    PRIMARY KEY,
1076         value   TEXT    NOT NULL
1077 );
1078
1079 COPY config.item_type_map FROM STDIN;
1080 a       Language material
1081 t       Manuscript language material
1082 g       Projected medium
1083 k       Two-dimensional nonprojectable graphic
1084 r       Three-dimensional artifact or naturally occurring object
1085 o       Kit
1086 p       Mixed materials
1087 e       Cartographic material
1088 f       Manuscript cartographic material
1089 c       Notated music
1090 d       Manuscript notated music
1091 i       Nonmusical sound recording
1092 j       Musical sound recording
1093 m       Computer file
1094 \.
1095
1096 COMMIT;
1097