[open-ils-commits] r16674 - in trunk/Open-ILS: examples src/sql/Pg src/sql/Pg/upgrade (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jun 11 09:01:55 EDT 2010
Author: scottmk
Date: 2010-06-11 09:01:54 -0400 (Fri, 11 Jun 2010)
New Revision: 16674
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0304.schema.query-expr-xcase-left-operand.sql
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/008.schema.query.sql
Log:
Add column "left_operand" to query.expr_xcase view.
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/0304.schema.query-expr-xcase-left-operand.sql
M Open-ILS/examples/fm_IDL.xml
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2010-06-11 05:00:56 UTC (rev 16673)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2010-06-11 13:01:54 UTC (rev 16674)
@@ -7039,10 +7039,12 @@
<field reporter:label="Is Parenthesized" name="parenthesize" reporter:datatype="bool"/>
<field reporter:label="Parent Expression" name="parent_expr" reporter:datatype="link"/>
<field reporter:label="Sequence Number" name="seq_no" reporter:datatype="int"/>
+ <field reporter:label="Left Operand" name="left_operand" reporter:datatype="link"/>
<field reporter:label="Negate?" name="negate" reporter:datatype="bool"/>
</fields>
<links>
<link field="parent_expr" reltype="has_a" key="id" map="" class="qxp"/>
+ <link field="left_operand" reltype="has_a" key="id" map="" class="qxp"/>
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
</permacrud>
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-11 05:00:56 UTC (rev 16673)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-06-11 13:01:54 UTC (rev 16674)
@@ -68,7 +68,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0303'); -- phasefx
+INSERT INTO config.upgrade_log (version) VALUES ('0304'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/008.schema.query.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/008.schema.query.sql 2010-06-11 05:00:56 UTC (rev 16673)
+++ trunk/Open-ILS/src/sql/Pg/008.schema.query.sql 2010-06-11 13:01:54 UTC (rev 16674)
@@ -442,6 +442,7 @@
parenthesize,
parent_expr,
seq_no,
+ left_operand,
negate
FROM
query.expression
@@ -457,6 +458,7 @@
parenthesize,
parent_expr,
seq_no,
+ left_operand,
negate
) VALUES (
COALESCE(NEW.id, NEXTVAL('query.expression_id_seq'::REGCLASS)),
@@ -464,6 +466,7 @@
COALESCE(NEW.parenthesize, FALSE),
NEW.parent_expr,
COALESCE(NEW.seq_no, 1),
+ NEW.left_operand,
COALESCE(NEW.negate, false)
);
@@ -475,6 +478,7 @@
parenthesize = NEW.parenthesize,
parent_expr = NEW.parent_expr,
seq_no = NEW.seq_no,
+ left_operand = NEW.left_operand,
negate = NEW.negate
WHERE
id = OLD.id;
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0304.schema.query-expr-xcase-left-operand.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0304.schema.query-expr-xcase-left-operand.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0304.schema.query-expr-xcase-left-operand.sql 2010-06-11 13:01:54 UTC (rev 16674)
@@ -0,0 +1,62 @@
+-- Add left_operand column to query.expr_xcase view
+
+-- If the view doesn't exist, this drop will fail, and that's okay
+DROP VIEW query.expr_xcase CASCADE;
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0304'); -- Scott McKellar
+
+CREATE OR REPLACE VIEW query.expr_xcase AS
+ SELECT
+ id,
+ parenthesize,
+ parent_expr,
+ seq_no,
+ left_operand,
+ negate
+ FROM
+ query.expression
+ WHERE
+ type = 'xcase';
+
+CREATE OR REPLACE RULE query_expr_xcase_insert_rule AS
+ ON INSERT TO query.expr_xcase
+ DO INSTEAD
+ INSERT INTO query.expression (
+ id,
+ type,
+ parenthesize,
+ parent_expr,
+ seq_no,
+ left_operand,
+ negate
+ ) VALUES (
+ COALESCE(NEW.id, NEXTVAL('query.expression_id_seq'::REGCLASS)),
+ 'xcase',
+ COALESCE(NEW.parenthesize, FALSE),
+ NEW.parent_expr,
+ COALESCE(NEW.seq_no, 1),
+ NEW.left_operand,
+ COALESCE(NEW.negate, false)
+ );
+
+CREATE OR REPLACE RULE query_expr_xcase_update_rule AS
+ ON UPDATE TO query.expr_xcase
+ DO INSTEAD
+ UPDATE query.expression SET
+ id = NEW.id,
+ parenthesize = NEW.parenthesize,
+ parent_expr = NEW.parent_expr,
+ seq_no = NEW.seq_no,
+ left_operand = NEW.left_operand,
+ negate = NEW.negate
+ WHERE
+ id = OLD.id;
+
+CREATE OR REPLACE RULE query_expr_xcase_delete_rule AS
+ ON DELETE TO query.expr_xcase
+ DO INSTEAD
+ DELETE FROM query.expression WHERE id = OLD.id;
+
+COMMIT;
More information about the open-ils-commits
mailing list