Show
Ignore:
Timestamp:
05/09/08 12:34:30 (4 months ago)
Author:
dbs
Message:

Merge rev. 9542 from trunk: add deferrable to all FKs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/rel_1_2/Open-ILS/src/sql/Pg/005.schema.actors.sql

    r9242 r9543  
    3333        email                   TEXT, 
    3434        passwd                  TEXT                            NOT NULL, 
    35         standing                INT                             NOT NULL DEFAULT 1 REFERENCES config.standing (id), 
    36         ident_type              INT                             NOT NULL REFERENCES config.identification_type (id), 
     35        standing                INT                             NOT NULL DEFAULT 1 REFERENCES config.standing (id) DEFERRABLE INITIALLY DEFERRED, 
     36        ident_type              INT                             NOT NULL REFERENCES config.identification_type (id) DEFERRABLE INITIALLY DEFERRED, 
    3737        ident_value             TEXT, 
    38         ident_type2             INT                             REFERENCES config.identification_type (id), 
     38        ident_type2             INT                             REFERENCES config.identification_type (id) DEFERRABLE INITIALLY DEFERRED, 
    3939        ident_value2            TEXT, 
    40         net_access_level        INT                             NOT NULL DEFAULT 1 REFERENCES config.net_access_level (id), 
     40        net_access_level        INT                             NOT NULL DEFAULT 1 REFERENCES config.net_access_level (id) DEFERRABLE INITIALLY DEFERRED, 
    4141        photo_url               TEXT, 
    4242        prefix                  TEXT, 
     
    139139CREATE TABLE actor.usr_note ( 
    140140        id              BIGSERIAL                       PRIMARY KEY, 
    141         usr             BIGINT                          NOT NULL REFERENCES actor.usr ON DELETE CASCADE, 
    142         creator         BIGINT                          NOT NULL REFERENCES actor.usr ON DELETE CASCADE, 
     141        usr             BIGINT                          NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     142        creator         BIGINT                          NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    143143        create_date     TIMESTAMP WITH TIME ZONE        DEFAULT NOW(), 
    144144        pub             BOOL                            NOT NULL DEFAULT FALSE, 
     
    150150CREATE TABLE actor.usr_standing_penalty ( 
    151151        id              SERIAL  PRIMARY KEY, 
    152         usr             INT     NOT NULL REFERENCES actor.usr ON DELETE CASCADE, 
     152        usr             INT     NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    153153        penalty_type    TEXT    NOT NULL 
    154154); 
     
    178178CREATE TABLE actor.usr_setting ( 
    179179        id      BIGSERIAL       PRIMARY KEY, 
    180         usr     INT             NOT NULL REFERENCES actor.usr ON DELETE CASCADE, 
     180        usr     INT             NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    181181        name    TEXT            NOT NULL, 
    182182        value   TEXT            NOT NULL, 
     
    311311CREATE TABLE actor.card ( 
    312312        id      SERIAL  PRIMARY KEY, 
    313         usr     INT     NOT NULL REFERENCES actor.usr (id), 
     313        usr     INT     NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    314314        barcode TEXT    NOT NULL UNIQUE, 
    315315        active  BOOL    NOT NULL DEFAULT TRUE 
     
    352352        opac_label      TEXT    NOT NULL, 
    353353        depth           INT     NOT NULL, 
    354         parent          INT     REFERENCES actor.org_unit_type (id), 
     354        parent          INT     REFERENCES actor.org_unit_type (id) DEFERRABLE INITIALLY DEFERRED, 
    355355        can_have_vols   BOOL    NOT NULL DEFAULT TRUE, 
    356356        can_have_users  BOOL    NOT NULL DEFAULT TRUE 
     
    367367CREATE TABLE actor.org_unit ( 
    368368        id              SERIAL  PRIMARY KEY, 
    369         parent_ou       INT     REFERENCES actor.org_unit (id), 
    370         ou_type         INT     NOT NULL REFERENCES actor.org_unit_type (id), 
     369        parent_ou       INT     REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     370        ou_type         INT     NOT NULL REFERENCES actor.org_unit_type (id) DEFERRABLE INITIALLY DEFERRED, 
    371371        ill_address     INT, 
    372372        holds_address   INT, 
     
    405405 
    406406CREATE TABLE actor.hours_of_operation ( 
    407         id              INT     PRIMARY KEY REFERENCES actor.org_unit (id) ON DELETE CASCADE, 
     407        id              INT     PRIMARY KEY REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    408408        dow_0_open      TIME    NOT NULL DEFAULT '09:00', 
    409409        dow_0_close     TIME    NOT NULL DEFAULT '17:00', 
     
    424424CREATE TABLE actor.org_unit_closed ( 
    425425        id              SERIAL                          PRIMARY KEY, 
    426         org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id), 
     426        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    427427        close_start     TIMESTAMP WITH TIME ZONE        NOT NULL, 
    428428        close_end       TIMESTAMP WITH TIME ZONE        NOT NULL, 
     
    434434        id              SERIAL  PRIMARY KEY, 
    435435        name            TEXT    NOT NULL UNIQUE, 
    436         owning_lib      INT     NOT NULL REFERENCES actor.org_unit (id) 
     436        owning_lib      INT     NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED 
    437437); 
    438438 
    439439CREATE TABLE actor.usr_org_unit_opt_in ( 
    440440        id              SERIAL                          PRIMARY KEY, 
    441         org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id), 
    442         usr             INT                             NOT NULL REFERENCES actor.usr (id), 
    443         staff           INT                             NOT NULL REFERENCES actor.usr (id), 
     441        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     442        usr             INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     443        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    444444        opt_in_ts       TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(), 
    445         opt_in_ws       INT                             NOT NULL REFERENCES actor.workstation (id), 
     445        opt_in_ws       INT                             NOT NULL REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED, 
    446446        CONSTRAINT usr_opt_in_once_per_org_unit UNIQUE (usr,org_unit) 
    447447); 
     
    449449CREATE TABLE actor.org_unit_setting ( 
    450450        id              BIGSERIAL       PRIMARY KEY, 
    451         org_unit        INT             NOT NULL REFERENCES actor.org_unit ON DELETE CASCADE, 
     451        org_unit        INT             NOT NULL REFERENCES actor.org_unit ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    452452        name            TEXT            NOT NULL, 
    453453        value           TEXT            NOT NULL, 
     
    486486        within_city_limits      BOOL    NOT NULL DEFAULT TRUE, 
    487487        address_type            TEXT    NOT NULL DEFAULT 'MAILING', 
    488         usr                     INT     NOT NULL REFERENCES actor.usr (id), 
     488        usr                     INT     NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    489489        street1                 TEXT    NOT NULL, 
    490490        street2                 TEXT, 
     
    510510        valid           BOOL    NOT NULL DEFAULT TRUE, 
    511511        address_type    TEXT    NOT NULL DEFAULT 'MAILING', 
    512         org_unit        INT     NOT NULL REFERENCES actor.org_unit (id), 
     512        org_unit        INT     NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    513513        street1         TEXT    NOT NULL, 
    514514        street2         TEXT,