Force deletion of Z39.50 attributes within the database when the Z39.50
source to which the attributes refer is deleted.
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
CREATE TABLE config.z3950_attr (
id SERIAL PRIMARY KEY,
- source TEXT NOT NULL REFERENCES config.z3950_source (name) DEFERRABLE INITIALLY DEFERRED,
+ source TEXT NOT NULL REFERENCES config.z3950_source (name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
name TEXT NOT NULL,
label TEXT NOT NULL,
code INT NOT NULL,
--- /dev/null
+
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE config.z3950_attr
+ DROP CONSTRAINT z3950_attr_source_fkey,
+ ADD CONSTRAINT z3950_attr_source_fkey
+ FOREIGN KEY (source)
+ REFERENCES config.z3950_source(name)
+ ON UPDATE CASCADE
+ ON DELETE CASCADE
+ DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;