From 18c6db692569170fe222ad1a1e92e3cee9db459d Mon Sep 17 00:00:00 2001 From: dbs Date: Sat, 7 Feb 2009 19:01:44 +0000 Subject: [PATCH] Make all FKs deferrable again git-svn-id: svn://svn.open-ils.org/ILS/trunk@12100 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 4 +- Open-ILS/src/sql/Pg/040.schema.asset.sql | 8 +-- Open-ILS/src/sql/Pg/070.schema.container.sql | 8 +-- Open-ILS/src/sql/Pg/080.schema.money.sql | 2 +- Open-ILS/src/sql/Pg/090.schema.action.sql | 2 +- Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql | 2 +- Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql | 2 +- Open-ILS/src/sql/Pg/200.schema.acq.sql | 80 +++++++++++----------- Open-ILS/src/sql/Pg/210.schema.serials.sql | 2 +- Open-ILS/src/sql/Pg/400.schema.action_trigger.sql | 22 +++--- Open-ILS/src/sql/Pg/extend-reporter.sql | 2 +- 12 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 26ea81a757..cac02de327 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -476,7 +476,7 @@ CREATE TABLE config.z3950_source ( CREATE TABLE config.z3950_attr ( id SERIAL PRIMARY KEY, - source TEXT NOT NULL REFERENCES config.z3950_source (name), + source TEXT NOT NULL REFERENCES config.z3950_source (name) DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, label TEXT NOT NULL, code INT NOT NULL, diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index dbdd1575c9..b9503e44a6 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -99,8 +99,8 @@ CREATE TABLE vandelay.bib_match ( -- DROP TABLE vandelay.import_item CASCADE; CREATE TABLE vandelay.import_item ( id BIGSERIAL PRIMARY KEY, - record BIGINT NOT NULL REFERENCES vandelay.queued_bib_record (id) ON DELETE CASCADE, - definition BIGINT NOT NULL REFERENCES vandelay.import_item_attr_definition (id) ON DELETE CASCADE, + record BIGINT NOT NULL REFERENCES vandelay.queued_bib_record (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + definition BIGINT NOT NULL REFERENCES vandelay.import_item_attr_definition (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, owning_lib INT, circ_lib INT, call_number TEXT, diff --git a/Open-ILS/src/sql/Pg/040.schema.asset.sql b/Open-ILS/src/sql/Pg/040.schema.asset.sql index 098792f03e..9b078132c6 100644 --- a/Open-ILS/src/sql/Pg/040.schema.asset.sql +++ b/Open-ILS/src/sql/Pg/040.schema.asset.sql @@ -69,8 +69,8 @@ CREATE RULE protect_copy_delete AS ON DELETE TO asset.copy DO INSTEAD UPDATE ass CREATE TABLE asset.copy_transparency ( id SERIAL PRIMARY KEY, deposit_amount NUMERIC(6,2), - owner INT NOT NULL REFERENCES actor.org_unit (id), - circ_lib INT REFERENCES actor.org_unit (id), + owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, + circ_lib INT REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, loan_duration INT CHECK ( loan_duration IN (1,2,3) ), fine_level INT CHECK ( fine_level IN (1,2,3) ), holdable BOOL, @@ -86,8 +86,8 @@ CREATE TABLE asset.copy_transparency ( CREATE TABLE asset.copy_tranparency_map ( id BIGSERIAL PRIMARY KEY, - tansparency INT NOT NULL REFERENCES asset.copy_transparency (id), - target_copy INT NOT NULL UNIQUE REFERENCES asset.copy (id) + tansparency INT NOT NULL REFERENCES asset.copy_transparency (id) DEFERRABLE INITIALLY DEFERRED, + target_copy INT NOT NULL UNIQUE REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED ); CREATE INDEX cp_tr_cp_idx ON asset.copy_tranparency_map (tansparency); diff --git a/Open-ILS/src/sql/Pg/070.schema.container.sql b/Open-ILS/src/sql/Pg/070.schema.container.sql index 910d12369f..2ae297c5a0 100644 --- a/Open-ILS/src/sql/Pg/070.schema.container.sql +++ b/Open-ILS/src/sql/Pg/070.schema.container.sql @@ -34,7 +34,7 @@ CREATE TABLE container.copy_bucket ( DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, - btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.copy_bucket_type (code), + btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.copy_bucket_type (code) DEFERRABLE INITIALLY DEFERRED, pub BOOL NOT NULL DEFAULT FALSE, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), CONSTRAINT cb_name_once_per_owner UNIQUE (owner,name,btype) @@ -74,7 +74,7 @@ CREATE TABLE container.call_number_bucket ( DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, - btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.call_number_bucket_type (code), + btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.call_number_bucket_type (code) DEFERRABLE INITIALLY DEFERRED, pub BOOL NOT NULL DEFAULT FALSE, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), CONSTRAINT cnb_name_once_per_owner UNIQUE (owner,name,btype) @@ -114,7 +114,7 @@ CREATE TABLE container.biblio_record_entry_bucket ( DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, - btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.biblio_record_entry_bucket_type (code), + btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.biblio_record_entry_bucket_type (code) DEFERRABLE INITIALLY DEFERRED, pub BOOL NOT NULL DEFAULT FALSE, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), CONSTRAINT breb_name_once_per_owner UNIQUE (owner,name,btype) @@ -153,7 +153,7 @@ CREATE TABLE container.user_bucket ( DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, - btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.user_bucket_type (code), + btype TEXT NOT NULL DEFAULT 'misc' REFERENCES container.user_bucket_type (code) DEFERRABLE INITIALLY DEFERRED, pub BOOL NOT NULL DEFAULT FALSE, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), CONSTRAINT ub_name_once_per_owner UNIQUE (owner,name,btype) diff --git a/Open-ILS/src/sql/Pg/080.schema.money.sql b/Open-ILS/src/sql/Pg/080.schema.money.sql index f88a31852b..b0fc53f9d6 100644 --- a/Open-ILS/src/sql/Pg/080.schema.money.sql +++ b/Open-ILS/src/sql/Pg/080.schema.money.sql @@ -56,7 +56,7 @@ CREATE TABLE money.billing ( void_time TIMESTAMP WITH TIME ZONE, amount NUMERIC(6,2) NOT NULL, billing_type TEXT NOT NULL, - btype INT NOT NULL REFERENCES config.billing_type (id) ON DELETE RESTRICT, + btype INT NOT NULL REFERENCES config.billing_type (id) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED, note TEXT ); CREATE INDEX m_b_xact_idx ON money.billing (xact); diff --git a/Open-ILS/src/sql/Pg/090.schema.action.sql b/Open-ILS/src/sql/Pg/090.schema.action.sql index 44c45636b0..bc43428801 100644 --- a/Open-ILS/src/sql/Pg/090.schema.action.sql +++ b/Open-ILS/src/sql/Pg/090.schema.action.sql @@ -269,7 +269,7 @@ CREATE TABLE action.hold_request ( prev_check_time TIMESTAMP WITH TIME ZONE, expire_time TIMESTAMP WITH TIME ZONE, cancel_time TIMESTAMP WITH TIME ZONE, - cancel_cause INT REFERENCES action.hold_request_cancel_cause (id) ON DELETE SET NULL, + cancel_cause INT REFERENCES action.hold_request_cancel_cause (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, cancel_note TEXT, target BIGINT NOT NULL, -- see hold_type current_copy BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, diff --git a/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql index 6820a9adb5..49ec817308 100644 --- a/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql @@ -19,7 +19,7 @@ BEGIN; CREATE SCHEMA extend_reporter; CREATE TABLE extend_reporter.legacy_circ_count ( - id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id), + id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED, circ_count INT NOT NULL DEFAULT 0 ); diff --git a/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql b/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql index 062cf706be..92066c691f 100644 --- a/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql @@ -20,7 +20,7 @@ CREATE SCHEMA extend_reporter; CREATE TABLE extend_reporter.legacy_circ_count ( - id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id), + id BIGSERIAL PRIMARY KEY REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED, circ_count INT NOT NULL DEFAULT 0 ); diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index 5926f1e3dd..887baf6514 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -20,8 +20,8 @@ INSERT INTO acq.currency_type (code, label) VALUES ('EUR','Euros'); CREATE TABLE acq.exchange_rate ( id SERIAL PRIMARY KEY, - from_currency TEXT NOT NULL REFERENCES acq.currency_type (code), - to_currency TEXT NOT NULL REFERENCES acq.currency_type (code), + from_currency TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, + to_currency TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, ratio NUMERIC NOT NULL, CONSTRAINT exchange_rate_from_to_once UNIQUE (from_currency,to_currency) ); @@ -32,8 +32,8 @@ INSERT INTO acq.exchange_rate (from_currency,to_currency,ratio) VALUES ('USD','E CREATE TABLE acq.provider ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, - owner INT NOT NULL REFERENCES actor.org_unit (id), - currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), + owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, + currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, code TEXT UNIQUE, CONSTRAINT provider_name_once_per_owner UNIQUE (name,owner) ); @@ -41,47 +41,47 @@ CREATE TABLE acq.provider ( CREATE TABLE acq.funding_source ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, - owner INT NOT NULL REFERENCES actor.org_unit (id), - currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), + owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, + currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, code TEXT UNIQUE, CONSTRAINT funding_source_name_once_per_owner UNIQUE (name,owner) ); CREATE TABLE acq.funding_source_credit ( id SERIAL PRIMARY KEY, - funding_source INT NOT NULL REFERENCES acq.funding_source (id), + funding_source INT NOT NULL REFERENCES acq.funding_source (id) DEFERRABLE INITIALLY DEFERRED, amount NUMERIC NOT NULL, note TEXT ); CREATE TABLE acq.fund ( id SERIAL PRIMARY KEY, - org INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE, + org INT NOT NULL REFERENCES actor.org_unit (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, year INT NOT NULL DEFAULT EXTRACT( YEAR FROM NOW() ), - currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), + currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, code TEXT UNIQUE, CONSTRAINT name_once_per_org_year UNIQUE (org,name,year) ); CREATE TABLE acq.fund_debit ( id SERIAL PRIMARY KEY, - fund INT NOT NULL REFERENCES acq.fund (id), + fund INT NOT NULL REFERENCES acq.fund (id) DEFERRABLE INITIALLY DEFERRED, origin_amount NUMERIC NOT NULL, -- pre-exchange-rate amount - origin_currency_type TEXT NOT NULL REFERENCES acq.currency_type (code), + origin_currency_type TEXT NOT NULL REFERENCES acq.currency_type (code) DEFERRABLE INITIALLY DEFERRED, amount NUMERIC NOT NULL, encumbrance BOOL NOT NULL DEFAULT TRUE, debit_type TEXT NOT NULL, - xfer_destination INT REFERENCES acq.fund (id) + xfer_destination INT REFERENCES acq.fund (id) DEFERRABLE INITIALLY DEFERRED ); CREATE TABLE acq.fund_allocation ( id SERIAL PRIMARY KEY, - funding_source INT NOT NULL REFERENCES acq.funding_source (id) ON UPDATE CASCADE ON DELETE CASCADE, - fund INT NOT NULL REFERENCES acq.fund (id) ON UPDATE CASCADE ON DELETE CASCADE, + funding_source INT NOT NULL REFERENCES acq.funding_source (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, + fund INT NOT NULL REFERENCES acq.fund (id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, amount NUMERIC, percent NUMERIC CHECK (percent IS NULL OR percent BETWEEN 0.0 AND 100.0), - allocator INT NOT NULL REFERENCES actor.usr (id), + allocator INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, note TEXT, CONSTRAINT allocation_amount_or_percent CHECK ((percent IS NULL AND amount IS NOT NULL) OR (percent IS NOT NULL AND amount IS NULL)) ); @@ -89,8 +89,8 @@ CREATE TABLE acq.fund_allocation ( CREATE TABLE acq.picklist ( id SERIAL PRIMARY KEY, - owner INT NOT NULL REFERENCES actor.usr (id), - org_unit INT NOT NULL REFERENCES actor.org_unit (id), + owner INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, + org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, name TEXT NOT NULL, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), @@ -99,11 +99,11 @@ CREATE TABLE acq.picklist ( CREATE TABLE acq.purchase_order ( id SERIAL PRIMARY KEY, - owner INT NOT NULL REFERENCES actor.usr (id), - ordering_agency INT NOT NULL REFERENCES actor.org_unit (id), + owner INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, + ordering_agency INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), - provider INT NOT NULL REFERENCES acq.provider (id), + provider INT NOT NULL REFERENCES acq.provider (id) DEFERRABLE INITIALLY DEFERRED, state TEXT NOT NULL DEFAULT 'new' ); CREATE INDEX po_owner_idx ON acq.purchase_order (owner); @@ -112,9 +112,9 @@ CREATE INDEX po_state_idx ON acq.purchase_order (state); CREATE TABLE acq.po_note ( id SERIAL PRIMARY KEY, - purchase_order INT NOT NULL REFERENCES acq.purchase_order (id), - creator INT NOT NULL REFERENCES actor.usr (id), - editor INT NOT NULL REFERENCES actor.usr (id), + purchase_order INT NOT NULL REFERENCES acq.purchase_order (id) DEFERRABLE INITIALLY DEFERRED, + creator INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, + editor INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), value TEXT NOT NULL @@ -123,15 +123,15 @@ CREATE INDEX po_note_po_idx ON acq.po_note (purchase_order); CREATE TABLE acq.lineitem ( id BIGSERIAL PRIMARY KEY, - selector INT NOT NULL REFERENCES actor.org_unit (id), - provider INT REFERENCES acq.provider (id), - purchase_order INT REFERENCES acq.purchase_order (id), - picklist INT REFERENCES acq.picklist (id), + selector INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, + provider INT REFERENCES acq.provider (id) DEFERRABLE INITIALLY DEFERRED, + purchase_order INT REFERENCES acq.purchase_order (id) DEFERRABLE INITIALLY DEFERRED, + picklist INT REFERENCES acq.picklist (id) DEFERRABLE INITIALLY DEFERRED, expected_recv_time TIMESTAMP WITH TIME ZONE, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), marc TEXT NOT NULL, - eg_bib_id INT REFERENCES biblio.record_entry (id), + eg_bib_id INT REFERENCES biblio.record_entry (id) DEFERRABLE INITIALLY DEFERRED, source_label TEXT, item_count INT NOT NULL DEFAULT 0, state TEXT NOT NULL DEFAULT 'new', @@ -142,9 +142,9 @@ CREATE INDEX li_pl_idx ON acq.lineitem (picklist); CREATE TABLE acq.lineitem_note ( id SERIAL PRIMARY KEY, - lineitem INT NOT NULL REFERENCES acq.lineitem (id), - creator INT NOT NULL REFERENCES actor.usr (id), - editor INT NOT NULL REFERENCES actor.usr (id), + lineitem INT NOT NULL REFERENCES acq.lineitem (id) DEFERRABLE INITIALLY DEFERRED, + creator INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, + editor INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, create_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), edit_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), value TEXT NOT NULL @@ -153,14 +153,14 @@ CREATE INDEX li_note_li_idx ON acq.lineitem_note (lineitem); CREATE TABLE acq.lineitem_detail ( id BIGSERIAL PRIMARY KEY, - lineitem INT NOT NULL REFERENCES acq.lineitem (id), - fund INT REFERENCES acq.fund (id), - fund_debit INT REFERENCES acq.fund_debit (id), - eg_copy_id BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL, + lineitem INT NOT NULL REFERENCES acq.lineitem (id) DEFERRABLE INITIALLY DEFERRED, + fund INT REFERENCES acq.fund (id) DEFERRABLE INITIALLY DEFERRED, + fund_debit INT REFERENCES acq.fund_debit (id) DEFERRABLE INITIALLY DEFERRED, + eg_copy_id BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, barcode TEXT, cn_label TEXT, - owning_lib INT REFERENCES actor.org_unit (id) ON DELETE SET NULL, - location INT REFERENCES asset.copy_location (id) ON DELETE SET NULL, + owning_lib INT REFERENCES actor.org_unit (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, + location INT REFERENCES asset.copy_location (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, recv_time TIMESTAMP WITH TIME ZONE ); @@ -182,7 +182,7 @@ CREATE TABLE acq.lineitem_marc_attr_definition ( CREATE TABLE acq.lineitem_provider_attr_definition ( id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'), xpath TEXT NOT NULL, - provider INT NOT NULL REFERENCES acq.provider (id) + provider INT NOT NULL REFERENCES acq.provider (id) DEFERRABLE INITIALLY DEFERRED ) INHERITS (acq.lineitem_attr_definition); CREATE TABLE acq.lineitem_generated_attr_definition ( @@ -192,7 +192,7 @@ CREATE TABLE acq.lineitem_generated_attr_definition ( CREATE TABLE acq.lineitem_usr_attr_definition ( id BIGINT PRIMARY KEY DEFAULT NEXTVAL('acq.lineitem_attr_definition_id_seq'), - usr INT NOT NULL REFERENCES actor.usr (id) + usr INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED ) INHERITS (acq.lineitem_attr_definition); CREATE TABLE acq.lineitem_local_attr_definition ( @@ -202,7 +202,7 @@ CREATE TABLE acq.lineitem_local_attr_definition ( CREATE TABLE acq.lineitem_attr ( id BIGSERIAL PRIMARY KEY, definition BIGINT NOT NULL, - lineitem BIGINT NOT NULL REFERENCES acq.lineitem (id), + lineitem BIGINT NOT NULL REFERENCES acq.lineitem (id) DEFERRABLE INITIALLY DEFERRED, attr_type TEXT NOT NULL, attr_name TEXT NOT NULL, attr_value TEXT NOT NULL diff --git a/Open-ILS/src/sql/Pg/210.schema.serials.sql b/Open-ILS/src/sql/Pg/210.schema.serials.sql index 56a4391760..9637dada77 100644 --- a/Open-ILS/src/sql/Pg/210.schema.serials.sql +++ b/Open-ILS/src/sql/Pg/210.schema.serials.sql @@ -10,7 +10,7 @@ CREATE TABLE asset.uri ( active BOOL NOT NULL DEFAULT TRUE ); -ALTER TABLE asset.call_number ADD COLUMN uri INT REFERENCES asset.uri (id); +ALTER TABLE asset.call_number ADD COLUMN uri INT REFERENCES asset.uri (id) DEFERRABLE INITIALLY DEFERRED; BEGIN; diff --git a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql index 8911ed9566..e84684d05a 100644 --- a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql +++ b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql @@ -87,12 +87,12 @@ INSERT INTO action_trigger.cleanup (module,description) VALUES ('ClearAllPending CREATE TABLE action_trigger.event_definition ( id SERIAL PRIMARY KEY, active BOOL NOT NULL DEFAULT TRUE, - owner INT NOT NULL REFERENCES actor.org_unit (id), - hook TEXT NOT NULL REFERENCES action_trigger.hook (key), - validator TEXT NOT NULL REFERENCES action_trigger.validator (module), - reactor TEXT NOT NULL REFERENCES action_trigger.reactor (module), - cleanup_success TEXT REFERENCES action_trigger.cleanup (module), - cleanup_failure TEXT REFERENCES action_trigger.cleanup (module), + owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, + hook TEXT NOT NULL REFERENCES action_trigger.hook (key) DEFERRABLE INITIALLY DEFERRED, + validator TEXT NOT NULL REFERENCES action_trigger.validator (module) DEFERRABLE INITIALLY DEFERRED, + reactor TEXT NOT NULL REFERENCES action_trigger.reactor (module) DEFERRABLE INITIALLY DEFERRED, + cleanup_success TEXT REFERENCES action_trigger.cleanup (module) DEFERRABLE INITIALLY DEFERRED, + cleanup_failure TEXT REFERENCES action_trigger.cleanup (module) DEFERRABLE INITIALLY DEFERRED, delay INTERVAL NOT NULL DEFAULT '5 minutes', delay_field TEXT, -- for instance, xact_start on a circ hook ... look for fields on hook.core_type where datatype=timestamp? If not set, delay from now() group_field TEXT, -- field from this.hook.core_type to batch event targets together on, fed into reactor a group at a time. @@ -102,11 +102,11 @@ CREATE TABLE action_trigger.event_definition ( CREATE TABLE action_trigger.environment ( id SERIAL PRIMARY KEY, - event_def INT NOT NULL REFERENCES action_trigger.event_definition (id), + event_def INT NOT NULL REFERENCES action_trigger.event_definition (id) DEFERRABLE INITIALLY DEFERRED, path TEXT, -- fields to flesh. given a hook with a core_type of circ, imagine circ_lib.parent_ou expanding to -- {flesh: 2, flesh_fields: {circ: ['circ_lib'], aou: ['parent_ou']}} ... default is to flesh all -- at flesh depth 1 - collector TEXT REFERENCES action_trigger.collector (module), -- if set, given the object at 'path', return some data + collector TEXT REFERENCES action_trigger.collector (module) DEFERRABLE INITIALLY DEFERRED, -- if set, given the object at 'path', return some data -- to be stashed at environment.