[open-ils-commits] r14905 - in trunk/Open-ILS/src/sql/Pg: . upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Nov 13 12:50:20 EST 2009
Author: miker
Date: 2009-11-13 12:50:16 -0500 (Fri, 13 Nov 2009)
New Revision: 14905
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0082.schema.user_setting_types.sql
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
add support for typed user settings as a prereq for opt-in on selected trigger definitions
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-11-13 17:04:16 UTC (rev 14904)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-11-13 17:50:16 UTC (rev 14905)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0081'); -- berick
+INSERT INTO config.upgrade_log (version) VALUES ('0082'); -- miker
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
@@ -564,7 +564,31 @@
( datatype <> 'link' AND fm_class IS NULL ) )
);
+CREATE TABLE config.usr_setting_type (
+ name TEXT PRIMARY KEY,
+ opac_visible BOOL NOT NULL DEFAULT FALSE,
+ label TEXT UNIQUE NOT NULL,
+ description TEXT,
+ datatype TEXT NOT NULL DEFAULT 'string',
+ fm_class TEXT,
+
+ --
+ -- define valid datatypes
+ --
+ CONSTRAINT coust_valid_datatype CHECK ( datatype IN
+ ( 'bool', 'integer', 'float', 'currency', 'interval',
+ 'date', 'string', 'object', 'array', 'link' ) ),
+
+ --
+ -- fm_class is meaningful only for 'link' datatype
+ --
+ CONSTRAINT coust_no_empty_link CHECK
+ ( ( datatype = 'link' AND fm_class IS NOT NULL ) OR
+ ( datatype <> 'link' AND fm_class IS NULL ) )
+
+);
+
-- Some handy functions, based on existing ones, to provide optional ingest normalization
CREATE OR REPLACE FUNCTION public.left_trunc( TEXT, INT ) RETURNS TEXT AS $func$
Modified: trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql 2009-11-13 17:04:16 UTC (rev 14904)
+++ trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql 2009-11-13 17:50:16 UTC (rev 14905)
@@ -150,7 +150,7 @@
CREATE TABLE actor.usr_setting (
id BIGSERIAL PRIMARY KEY,
usr INT NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- name TEXT NOT NULL,
+ name TEXT NOT NULL REFERENCES config.usr_setting_type (name) ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED,
value TEXT NOT NULL,
CONSTRAINT usr_once_per_key UNIQUE (usr,name)
);
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-11-13 17:04:16 UTC (rev 14904)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2009-11-13 17:50:16 UTC (rev 14905)
@@ -1458,6 +1458,33 @@
-- hold matrix - 110.hold_matrix.sql:
INSERT INTO config.hold_matrix_matchpoint (requestor_grp) VALUES (1);
+
+-- User setting types
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_font', TRUE, 'OPAC Font Size', 'OPAC Font Size', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_search_depth', TRUE, 'OPAC Search Depth', 'OPAC Search Depth', 'integer');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_search_location', TRUE, 'OPAC Search Location', 'OPAC Search Location', 'integer');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.hits_per_page', TRUE, 'Hits per Page', 'Hits per Page', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.hold_notify', TRUE, 'Hold Notification Format', 'Hold Notification Format', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('staff_client.catalog.record_view.default', TRUE, 'Default Record View', 'Default Record View', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('staff_client.copy_editor.templates', TRUE, 'Copy Editor Template', 'Copy Editor Template', 'object');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('circ.holds_behind_desk', FALSE, 'Hold is behind Circ Desk', 'Hold is behind Circ Desk', 'bool');
+
+
-- org_unit setting types
INSERT into config.org_unit_setting_type
( name, label, description, datatype ) VALUES
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0082.schema.user_setting_types.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0082.schema.user_setting_types.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0082.schema.user_setting_types.sql 2009-11-13 17:50:16 UTC (rev 14905)
@@ -0,0 +1,77 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0082'); -- miker
+
+CREATE TABLE config.usr_setting_type (
+
+ name TEXT PRIMARY KEY,
+ opac_visible BOOL NOT NULL DEFAULT FALSE,
+ label TEXT UNIQUE NOT NULL,
+ description TEXT,
+ datatype TEXT NOT NULL DEFAULT 'string',
+ fm_class TEXT,
+
+ --
+ -- define valid datatypes
+ --
+ CONSTRAINT coust_valid_datatype CHECK ( datatype IN
+ ( 'bool', 'integer', 'float', 'currency', 'interval',
+ 'date', 'string', 'object', 'array', 'link' ) ),
+
+ --
+ -- fm_class is meaningful only for 'link' datatype
+ --
+ CONSTRAINT coust_no_empty_link CHECK
+ ( ( datatype = 'link' AND fm_class IS NOT NULL ) OR
+ ( datatype <> 'link' AND fm_class IS NULL ) )
+
+);
+
+-- Yeah, this is data, but I need it for the schema bit at the end
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_font', TRUE, 'OPAC Font Size', 'OPAC Font Size', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_search_depth', TRUE, 'OPAC Search Depth', 'OPAC Search Depth', 'integer');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.default_search_location', TRUE, 'OPAC Search Location', 'OPAC Search Location', 'integer');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.hits_per_page', TRUE, 'Hits per Page', 'Hits per Page', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('opac.hold_notify', TRUE, 'Hold Notification Format', 'Hold Notification Format', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('staff_client.catalog.record_view.default', TRUE, 'Default Record View', 'Default Record View', 'string');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('staff_client.copy_editor.templates', TRUE, 'Copy Editor Template', 'Copy Editor Template', 'object');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ VALUES ('circ.holds_behind_desk', FALSE, 'Hold is behind Circ Desk', 'Hold is behind Circ Desk', 'bool');
+
+INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype)
+ SELECT DISTINCT name, FALSE, name, name, 'string'
+ FROM actor.usr_setting
+ WHERE name NOT IN (
+ 'circ.holds_behind_desk',
+ 'opac.default_font',
+ 'opac.default_search_depth',
+ 'opac.default_search_location',
+ 'opac.hits_per_page',
+ 'opac.hold_notify',
+ 'staff_client.catalog.record_view.default',
+ 'staff_client.copy_editor.templates'
+ );
+
+
+ATLER TABLE actor.usr_setting
+ ADD CONSTRAINT user_setting_type_fkey
+ FOREIGN KEY (name) REFERENCES config.usr_setting_type (name)
+ ON DELETE CASCADE ON UPDATE CASCADE
+ DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;
+
More information about the open-ils-commits
mailing list