[open-ils-commits] r12100 - trunk/Open-ILS/src/sql/Pg (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Feb 7 14:01:47 EST 2009
Author: dbs
Date: 2009-02-07 14:01:44 -0500 (Sat, 07 Feb 2009)
New Revision: 12100
Modified:
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql
trunk/Open-ILS/src/sql/Pg/070.schema.container.sql
trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
trunk/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql
trunk/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql
trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql
trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
trunk/Open-ILS/src/sql/Pg/extend-reporter.sql
Log:
Make all FKs deferrable again
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -476,7 +476,7 @@
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,
Modified: trunk/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/012.schema.vandelay.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/012.schema.vandelay.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -99,8 +99,8 @@
-- 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,
Modified: trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/040.schema.asset.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -69,8 +69,8 @@
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_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);
Modified: trunk/Open-ILS/src/sql/Pg/070.schema.container.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/070.schema.container.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/070.schema.container.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -34,7 +34,7 @@
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 @@
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 @@
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 @@
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)
Modified: trunk/Open-ILS/src/sql/Pg/080.schema.money.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/080.schema.money.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -56,7 +56,7 @@
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);
Modified: trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -269,7 +269,7 @@
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,
Modified: trunk/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/1.2.2.1-1.2.2.2-upgrade-db.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -19,7 +19,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
);
Modified: trunk/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/1.2.2.2-1.2.2.3-upgrade-db.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -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
);
Modified: trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/200.schema.acq.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -20,8 +20,8 @@
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 @@
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.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.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.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 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 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 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 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_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_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_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
Modified: trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/210.schema.serials.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -10,7 +10,7 @@
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;
Modified: trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -87,12 +87,12 @@
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.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.<label>
label TEXT CHECK (label NOT IN ('result','target','event')),
CONSTRAINT env_event_label_once UNIQUE (event_def,label)
@@ -115,7 +115,7 @@
CREATE TABLE action_trigger.event (
id BIGSERIAL PRIMARY KEY,
target BIGINT NOT NULL, -- points at the id from class defined by event_def.hook.core_type
- event_def INT REFERENCES action_trigger.event_definition (id),
+ event_def INT REFERENCES action_trigger.event_definition (id) DEFERRABLE INITIALLY DEFERRED,
add_time TIMESTAMPTZ NOT NULL DEFAULT NOW(),
run_time TIMESTAMPTZ NOT NULL,
start_time TIMESTAMPTZ,
@@ -129,9 +129,9 @@
CREATE TABLE action_trigger.event_params (
id BIGSERIAL 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,
param TEXT NOT NULL, -- the key under environment.event.params to store the output of ...
- value TEXT NOT NULL, -- ... the eval() output of this. Has access to environmen (and, well, all of perl)
+ value TEXT NOT NULL, -- ... the eval() output of this. Has access to environment (and, well, all of perl)
CONSTRAINT event_params_event_def_param_once UNIQUE (event_def,param)
);
Modified: trunk/Open-ILS/src/sql/Pg/extend-reporter.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/extend-reporter.sql 2009-02-06 22:11:32 UTC (rev 12099)
+++ trunk/Open-ILS/src/sql/Pg/extend-reporter.sql 2009-02-07 19:01:44 UTC (rev 12100)
@@ -21,7 +21,7 @@
CREATE SCHEMA extend_reporter;
CREATE TABLE extend_reporter.legacy_circ_count (
- id BIGINT PRIMARY KEY REFERENCES asset.copy (id),
+ id BIGINT PRIMARY KEY REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED,
circ_count INT NOT NULL DEFAULT 0
);
More information about the open-ils-commits
mailing list