From 88e26087a293b2974727fb5c7abe4ab7fe738b9e Mon Sep 17 00:00:00 2001 From: scottmk Date: Mon, 10 May 2010 18:42:52 +0000 Subject: [PATCH] Add to query.expression: foreign key bind_variable pointing to query.bind_variable. Also: allow the expression type 'xbind'. M Open-ILS/src/sql/Pg/002.schema.config.sql M Open-ILS/src/sql/Pg/008.schema.query.sql A Open-ILS/src/sql/Pg/upgrade/0255.query-expr-bind.sql M Open-ILS/examples/fm_IDL.xml git-svn-id: svn://svn.open-ils.org/ILS/trunk@16413 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 2 ++ Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/008.schema.query.sql | 7 +++-- .../src/sql/Pg/upgrade/0255.query-expr-bind.sql | 33 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0255.query-expr-bind.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 1b01838250..cf889ea5a6 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -6608,6 +6608,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + @@ -6616,6 +6617,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 0981b7893a..fc1a1d99e2 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -65,7 +65,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0254'); -- Scott McKellar +INSERT INTO config.upgrade_log (version) VALUES ('0255'); -- Scott McKellar CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/008.schema.query.sql b/Open-ILS/src/sql/Pg/008.schema.query.sql index cfa921e520..bf96b8d20e 100644 --- a/Open-ILS/src/sql/Pg/008.schema.query.sql +++ b/Open-ILS/src/sql/Pg/008.schema.query.sql @@ -121,9 +121,10 @@ CREATE TABLE query.bind_variable ( CREATE TABLE query.expression ( id SERIAL PRIMARY KEY, - type TEXT NOT NULL CONSTRAINT predicate_type CHECK + type TEXT NOT NULL CONSTRAINT expression_type CHECK ( type IN ( 'xbet', -- between + 'xbind', -- bind variable 'xbool', -- boolean 'xcase', -- case 'xcast', -- cast @@ -157,7 +158,9 @@ CREATE TABLE query.expression ( DEFERRABLE INITIALLY DEFERRED, cast_type INT REFERENCES query.datatype DEFERRABLE INITIALLY DEFERRED, - negate BOOL NOT NULL DEFAULT FALSE + negate BOOL NOT NULL DEFAULT FALSE, + bind_variable TEXT REFERENCES query.bind_variable + DEFERRABLE INITIALLY DEFERRED ); CREATE UNIQUE INDEX query_expr_parent_seq diff --git a/Open-ILS/src/sql/Pg/upgrade/0255.query-expr-bind.sql b/Open-ILS/src/sql/Pg/upgrade/0255.query-expr-bind.sql new file mode 100644 index 0000000000..c9edc69e77 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0255.query-expr-bind.sql @@ -0,0 +1,33 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0255'); -- Scott McKellar + +ALTER TABLE query.expression + ADD CONSTRAINT expression_type CHECK + ( type IN ( + 'xbet', + 'xbind', + 'xbool', + 'xcase', + 'xcast', + 'xcol', + 'xex', + 'xfld', + 'xfunc', + 'xin', + 'xnull', + 'xnum', + 'xop', + 'xstr', + 'xsubq' +)); + +ALTER TABLE query.expression + DROP CONSTRAINT predicate_type; + +ALTER TABLE query.expression + ADD COLUMN bind_variable TEXT + REFERENCES query.bind_variable + DEFERRABLE INITIALLY DEFERRED; + +COMMIT; -- 2.11.0