From 38e65097b64be3cd141c6807655bf570fc9bc094 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 24 May 2011 16:55:47 -0400 Subject: [PATCH] Bring serial.unit in line with asset.copy Signed-off-by: Dan Wells --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/210.schema.serials.sql | 5 +++++ Open-ILS/src/sql/Pg/901.audit-tables.sql | 3 +++ .../0540.schema.missing_serial_unit_triggers.sql | 19 +++++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0540.schema.missing_serial_unit_triggers.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 28799232c..1b9890e92 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -86,7 +86,7 @@ CREATE TRIGGER no_overlapping_deps BEFORE INSERT OR UPDATE ON config.db_patch_dependencies FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates'); -INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0538', :eg_version); -- senator +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0540', :eg_version); -- dbwells CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/210.schema.serials.sql b/Open-ILS/src/sql/Pg/210.schema.serials.sql index 56f6f547a..9b884b6b6 100644 --- a/Open-ILS/src/sql/Pg/210.schema.serials.sql +++ b/Open-ILS/src/sql/Pg/210.schema.serials.sql @@ -225,6 +225,11 @@ CREATE TRIGGER autogenerate_placeholder_barcode FOR EACH ROW EXECUTE PROCEDURE asset.autogenerate_placeholder_barcode() ; +-- must create this trigger explicitly; it is not inherited from asset.copy +CREATE TRIGGER sunit_status_changed_trig + BEFORE UPDATE ON serial.unit + FOR EACH ROW EXECUTE PROCEDURE asset.acp_status_changed(); + CREATE TABLE serial.item ( id SERIAL PRIMARY KEY, creator INT NOT NULL diff --git a/Open-ILS/src/sql/Pg/901.audit-tables.sql b/Open-ILS/src/sql/Pg/901.audit-tables.sql index 56aabe27b..72980ee61 100644 --- a/Open-ILS/src/sql/Pg/901.audit-tables.sql +++ b/Open-ILS/src/sql/Pg/901.audit-tables.sql @@ -36,6 +36,9 @@ CREATE INDEX aud_asset_cn_hist_editor_idx ON auditor.asset_call_number_h SELECT auditor.create_auditor ( 'asset', 'copy' ); CREATE INDEX aud_asset_cp_hist_creator_idx ON auditor.asset_copy_history ( creator ); CREATE INDEX aud_asset_cp_hist_editor_idx ON auditor.asset_copy_history ( editor ); +SELECT auditor.create_auditor ( 'serial', 'unit' ); +CREATE INDEX aud_serial_unit_hist_creator_idx ON auditor.serial_unit_history ( creator ); +CREATE INDEX aud_serial_unit_hist_editor_idx ON auditor.serial_unit_history ( editor ); SELECT auditor.create_auditor ( 'acq', 'invoice' ); diff --git a/Open-ILS/src/sql/Pg/upgrade/0540.schema.missing_serial_unit_triggers.sql b/Open-ILS/src/sql/Pg/upgrade/0540.schema.missing_serial_unit_triggers.sql new file mode 100644 index 000000000..43d8f16b4 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0540.schema.missing_serial_unit_triggers.sql @@ -0,0 +1,19 @@ +-- Evergreen DB patch 0540.schema.missing_serial_unit_triggers.sql +-- +-- Bring serial.unit into line with asset.copy +-- +BEGIN; + + +-- check whether patch can be applied +SELECT evergreen.upgrade_deps_block_check('0540', :eg_version); + +CREATE TRIGGER sunit_status_changed_trig + BEFORE UPDATE ON serial.unit + FOR EACH ROW EXECUTE PROCEDURE asset.acp_status_changed(); + +SELECT auditor.create_auditor ( 'serial', 'unit' ); +CREATE INDEX aud_serial_unit_hist_creator_idx ON auditor.serial_unit_history ( creator ); +CREATE INDEX aud_serial_unit_hist_editor_idx ON auditor.serial_unit_history ( editor ); + +COMMIT; -- 2.11.0