[open-ils-commits] r19360 - in branches/rel_2_0/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 1 22:29:29 EST 2011
Author: dbs
Date: 2011-02-01 22:29:27 -0500 (Tue, 01 Feb 2011)
New Revision: 19360
Added:
branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0481.schema.serial_unit_generate_barcode_trigger.sql
Modified:
branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
branches/rel_2_0/Open-ILS/src/sql/Pg/210.schema.serials.sql
Log:
Apply autogenerate barcode trigger to serial.unit to enable serial checkin
Serial checkin tried to use the '@@AUTO' macro to autogenerate barcodes,
but unfortunately the required trigger had only been defined on the parent
table asset.copy and not on the child table serial.unit. Here we define the
trigger on serial.unit to resolve that problem.
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2011-02-02 03:28:33 UTC (rev 19359)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2011-02-02 03:29:27 UTC (rev 19360)
@@ -70,7 +70,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0480'); -- phasefx
+INSERT INTO config.upgrade_log (version) VALUES ('0481'); -- dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: branches/rel_2_0/Open-ILS/src/sql/Pg/210.schema.serials.sql
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/210.schema.serials.sql 2011-02-02 03:28:33 UTC (rev 19359)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/210.schema.serials.sql 2011-02-02 03:29:27 UTC (rev 19360)
@@ -219,6 +219,12 @@
-- must create this rule explicitly; it is not inherited from asset.copy
CREATE RULE protect_serial_unit_delete AS ON DELETE TO serial.unit DO INSTEAD UPDATE serial.unit SET deleted = TRUE WHERE OLD.id = serial.unit.id;
+-- must create this trigger explicitly; it is not inherited from asset.copy
+CREATE TRIGGER autogenerate_placeholder_barcode
+ BEFORE INSERT OR UPDATE ON serial.unit
+ FOR EACH ROW EXECUTE PROCEDURE asset.autogenerate_placeholder_barcode()
+;
+
CREATE TABLE serial.item (
id SERIAL PRIMARY KEY,
creator INT NOT NULL
Copied: branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0481.schema.serial_unit_generate_barcode_trigger.sql (from rev 19359, trunk/Open-ILS/src/sql/Pg/upgrade/0481.schema.serial_unit_generate_barcode_trigger.sql)
===================================================================
--- branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0481.schema.serial_unit_generate_barcode_trigger.sql (rev 0)
+++ branches/rel_2_0/Open-ILS/src/sql/Pg/upgrade/0481.schema.serial_unit_generate_barcode_trigger.sql 2011-02-02 03:29:27 UTC (rev 19360)
@@ -0,0 +1,12 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log(version) VALUES ('0481'); -- dbs
+
+-- We defined the same trigger on the parent table asset.copy
+-- but we need to define it on child tables explicitly as well
+CREATE TRIGGER autogenerate_placeholder_barcode
+ BEFORE INSERT OR UPDATE ON serial.unit
+ FOR EACH ROW EXECUTE PROCEDURE asset.autogenerate_placeholder_barcode()
+;
+
+COMMIT;
More information about the open-ils-commits
mailing list