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,
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
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' );
--- /dev/null
+-- 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;