[open-ils-commits] r15284 - in branches/rel_1_6_0/Open-ILS/src/sql/Pg: . upgrade (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 8 10:28:59 EST 2010
Author: dbs
Date: 2010-01-08 10:28:57 -0500 (Fri, 08 Jan 2010)
New Revision: 15284
Added:
branches/rel_1_6_0/Open-ILS/src/sql/Pg/upgrade/0131.schema.serials.protect-delete.sql
Modified:
branches/rel_1_6_0/Open-ILS/src/sql/Pg/002.schema.config.sql
branches/rel_1_6_0/Open-ILS/src/sql/Pg/210.schema.serials.sql
Log:
Backport r15266 from trunk: Protect serials from being deleted with ye olde ON DELETE rule
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-01-08 15:28:28 UTC (rev 15283)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-01-08 15:28:57 UTC (rev 15284)
@@ -51,7 +51,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0025'); --miker
+INSERT INTO config.upgrade_log (version) VALUES ('0131'); -- dbs
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: branches/rel_1_6_0/Open-ILS/src/sql/Pg/210.schema.serials.sql
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-01-08 15:28:28 UTC (rev 15283)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/210.schema.serials.sql 2010-01-08 15:28:57 UTC (rev 15284)
@@ -24,6 +24,8 @@
CREATE INDEX serial_record_entry_editor_idx ON serial.record_entry ( editor );
CREATE INDEX serial_record_entry_owning_lib_idx ON serial.record_entry ( owning_lib, deleted );
+CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD UPDATE serial.record_entry SET deleted = true WHERE old.id = serial.record_entry.id;
+
CREATE TABLE serial.subscription (
id SERIAL PRIMARY KEY,
callnumber BIGINT REFERENCES asset.call_number (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
Copied: branches/rel_1_6_0/Open-ILS/src/sql/Pg/upgrade/0131.schema.serials.protect-delete.sql (from rev 15282, branches/rel_1_6/Open-ILS/src/sql/Pg/upgrade/0131.schema.serials.protect-delete.sql)
===================================================================
--- branches/rel_1_6_0/Open-ILS/src/sql/Pg/upgrade/0131.schema.serials.protect-delete.sql (rev 0)
+++ branches/rel_1_6_0/Open-ILS/src/sql/Pg/upgrade/0131.schema.serials.protect-delete.sql 2010-01-08 15:28:57 UTC (rev 15284)
@@ -0,0 +1,7 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0130'); -- dbs
+
+CREATE RULE protect_mfhd_delete AS ON DELETE TO serial.record_entry DO INSTEAD UPDATE serial.record_entry SET deleted = true WHERE old.id = serial.record_entry.id;
+
+COMMIT;
More information about the open-ils-commits
mailing list