Changeset 9543

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

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

Location:
branches/rel_1_2/Open-ILS/src/sql/Pg
Files:
8 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, 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/006.schema.permissions.sql

    r7158 r9543  
    1414        id                      SERIAL  PRIMARY KEY, 
    1515        name                    TEXT    NOT NULL UNIQUE, 
    16         parent                  INT     REFERENCES permission.grp_tree (id) ON DELETE RESTRICT, 
     16        parent                  INT     REFERENCES permission.grp_tree (id) ON DELETE RESTRICT DEFERRABLE INITIALLY DEFERRED, 
    1717        usergroup               BOOL    NOT NULL DEFAULT TRUE, 
    1818        perm_interval           INTERVAL DEFAULT '3 years'::interval NOT NULL, 
     
    2424CREATE TABLE permission.grp_perm_map ( 
    2525        id              SERIAL  PRIMARY KEY, 
    26         grp             INT     NOT NULL REFERENCES permission.grp_tree (id) ON DELETE CASCADE, 
    27         perm            INT     NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE, 
     26        grp             INT     NOT NULL REFERENCES permission.grp_tree (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     27        perm            INT     NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    2828        depth           INT     NOT NULL, 
    2929        grantable       BOOL    NOT NULL DEFAULT FALSE, 
     
    3333CREATE TABLE permission.usr_perm_map ( 
    3434        id              SERIAL  PRIMARY KEY, 
    35         usr             INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE, 
    36         perm            INT     NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE, 
     35        usr             INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     36        perm            INT     NOT NULL REFERENCES permission.perm_list (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    3737        depth           INT     NOT NULL, 
    3838        grantable       BOOL    NOT NULL DEFAULT FALSE, 
     
    4242CREATE TABLE permission.usr_grp_map ( 
    4343        id      SERIAL  PRIMARY KEY, 
    44         usr     INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE, 
    45         grp     INT     NOT NULL REFERENCES permission.grp_tree (id) ON DELETE CASCADE, 
     44        usr     INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     45        grp     INT     NOT NULL REFERENCES permission.grp_tree (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    4646                CONSTRAINT usr_grp_once UNIQUE (usr,grp) 
    4747); 
     
    8282CREATE TABLE permission.usr_work_ou_map ( 
    8383        id      SERIAL  PRIMARY KEY, 
    84         usr     INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE, 
    85         work_ou INT     NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE, 
     84        usr     INT     NOT NULL REFERENCES actor.usr (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     85        work_ou INT     NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    8686                CONSTRAINT usr_work_ou_once UNIQUE (usr,work_ou) 
    8787); 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/011.schema.authority.sql

    r4794 r9543  
    2424CREATE TABLE authority.record_note ( 
    2525        id              BIGSERIAL       PRIMARY KEY, 
    26         record          BIGINT          NOT NULL REFERENCES authority.record_entry (id), 
     26        record          BIGINT          NOT NULL REFERENCES authority.record_entry (id) DEFERRABLE INITIALLY DEFERRED, 
    2727        value           TEXT            NOT NULL, 
    2828        creator         INT             NOT NULL DEFAULT 1, 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/080.schema.money.sql

    r8052 r9543  
    77CREATE TABLE money.collections_tracker ( 
    88        id              BIGSERIAL                       PRIMARY KEY, 
    9         usr             INT                             NOT NULL REFERENCES actor.usr (id), -- actor.usr.id 
    10         collector       INT                             NOT NULL REFERENCES actor.usr (id), 
    11         location        INT                             NOT NULL REFERENCES actor.org_unit (id), 
     9        usr             INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, -- actor.usr.id 
     10        collector       INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     11        location        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    1212        enter_time      TIMESTAMP WITH TIME ZONE 
    1313); 
     
    286286 
    287287CREATE TABLE money.bnm_desk_payment ( 
    288         cash_drawer     INT     REFERENCES actor.workstation (id) 
     288        cash_drawer     INT     REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED 
    289289) INHERITS (money.bnm_payment); 
    290290ALTER TABLE money.bnm_desk_payment ADD PRIMARY KEY (id); 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/090.schema.action.sql

    r8908 r9543  
    77CREATE TABLE action.in_house_use ( 
    88        id              SERIAL                          PRIMARY KEY, 
    9         item            BIGINT                          NOT NULL REFERENCES asset.copy (id), 
    10         staff           INT                             NOT NULL REFERENCES actor.usr (id), 
    11         org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id), 
     9        item            BIGINT                          NOT NULL REFERENCES asset.copy (id) DEFERRABLE INITIALLY DEFERRED, 
     10        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     11        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    1212        use_time        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW() 
    1313); 
     
    1515CREATE TABLE action.non_cataloged_circulation ( 
    1616        id              SERIAL                          PRIMARY KEY, 
    17         patron          INT                             NOT NULL REFERENCES actor.usr (id), 
    18         staff           INT                             NOT NULL REFERENCES actor.usr (id), 
    19         circ_lib        INT                             NOT NULL REFERENCES actor.org_unit (id), 
    20         item_type       INT                             NOT NULL REFERENCES config.non_cataloged_type (id), 
     17        patron          INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     18        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     19        circ_lib        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     20        item_type       INT                             NOT NULL REFERENCES config.non_cataloged_type (id) DEFERRABLE INITIALLY DEFERRED, 
    2121        circ_time       TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW() 
    2222); 
     
    2424CREATE TABLE action.non_cat_in_house_use ( 
    2525        id              SERIAL                          PRIMARY KEY, 
    26         item_type       BIGINT                          NOT NULL REFERENCES config.non_cataloged_type(id), 
    27         staff           INT                             NOT NULL REFERENCES actor.usr (id), 
    28         org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id), 
     26        item_type       BIGINT                          NOT NULL REFERENCES config.non_cataloged_type(id) DEFERRABLE INITIALLY DEFERRED, 
     27        staff           INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     28        org_unit        INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    2929        use_time        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW() 
    3030); 
     
    3232CREATE TABLE action.survey ( 
    3333        id              SERIAL                          PRIMARY KEY, 
    34         owner           INT                             NOT NULL REFERENCES actor.org_unit (id), 
     34        owner           INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
    3535        start_date      TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(), 
    3636        end_date        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW() + '10 years'::INTERVAL, 
     
    4646CREATE TABLE action.survey_question ( 
    4747        id              SERIAL  PRIMARY KEY, 
    48         survey          INT     NOT NULL REFERENCES action.survey, 
     48        survey          INT     NOT NULL REFERENCES action.survey DEFERRABLE INITIALLY DEFERRED, 
    4949        question        TEXT    NOT NULL 
    5050); 
     
    5252CREATE TABLE action.survey_answer ( 
    5353        id              SERIAL  PRIMARY KEY, 
    54         question        INT     NOT NULL REFERENCES action.survey_question, 
     54        question        INT     NOT NULL REFERENCES action.survey_question DEFERRABLE INITIALLY DEFERRED, 
    5555        answer          TEXT    NOT NULL 
    5656); 
     
    6262        response_group_id       INT, 
    6363        usr                     INT, -- REFERENCES actor.usr 
    64         survey                  INT                             NOT NULL REFERENCES action.survey, 
    65         question                INT                             NOT NULL REFERENCES action.survey_question, 
    66         answer                  INT                             NOT NULL REFERENCES action.survey_answer, 
     64        survey                  INT                             NOT NULL REFERENCES action.survey DEFERRABLE INITIALLY DEFERRED, 
     65        question                INT                             NOT NULL REFERENCES action.survey_question DEFERRABLE INITIALLY DEFERRED, 
     66        answer                  INT                             NOT NULL REFERENCES action.survey_answer DEFERRABLE INITIALLY DEFERRED, 
    6767        answer_date             TIMESTAMP WITH TIME ZONE, 
    6868        effective_date          TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW() 
     
    176176        cancel_time             TIMESTAMP WITH TIME ZONE, 
    177177        target                  BIGINT                          NOT NULL, -- see hold_type 
    178         current_copy            BIGINT                          REFERENCES asset.copy (id) ON DELETE SET NULL, 
    179         fulfillment_staff       INT                             REFERENCES actor.usr (id), 
    180         fulfillment_lib         INT                             REFERENCES actor.org_unit (id), 
    181         request_lib             INT                             NOT NULL REFERENCES actor.org_unit (id), 
    182         requestor               INT                             NOT NULL REFERENCES actor.usr (id), 
    183         usr                     INT                             NOT NULL REFERENCES actor.usr (id), 
     178        current_copy            BIGINT                          REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED, 
     179        fulfillment_staff       INT                             REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     180        fulfillment_lib         INT                             REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     181        request_lib             INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     182        requestor               INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
     183        usr                     INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    184184        selection_ou            INT                             NOT NULL, 
    185185        selection_depth         INT                             NOT NULL DEFAULT 0, 
    186         pickup_lib              INT                             NOT NULL REFERENCES actor.org_unit, 
     186        pickup_lib              INT                             NOT NULL REFERENCES actor.org_unit DEFERRABLE INITIALLY DEFERRED, 
    187187        hold_type               TEXT                            NOT NULL CHECK (hold_type IN ('M','T','V','C')), 
    188188        holdable_formats        TEXT, 
     
    202202CREATE TABLE action.hold_notification ( 
    203203        id              SERIAL                          PRIMARY KEY, 
    204         hold            INT                             NOT NULL REFERENCES action.hold_request (id), 
    205         notify_staff    INT                             REFERENCES actor.usr (id), 
     204        hold            INT                             NOT NULL REFERENCES action.hold_request (id) DEFERRABLE INITIALLY DEFERRED, 
     205        notify_staff    INT                             REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    206206        notify_time     TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(), 
    207207        method          TEXT                            NOT NULL, -- email address or phone number 
     
    212212CREATE TABLE action.hold_copy_map ( 
    213213        id              SERIAL  PRIMARY KEY, 
    214         hold            INT     NOT NULL REFERENCES action.hold_request (id) ON DELETE CASCADE, 
    215         target_copy     BIGINT  NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE, 
     214        hold            INT     NOT NULL REFERENCES action.hold_request (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     215        target_copy     BIGINT  NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
    216216        CONSTRAINT copy_once_per_hold UNIQUE (hold,target_copy) 
    217217); 
     
    223223        source_send_time        TIMESTAMP WITH TIME ZONE, 
    224224        dest_recv_time          TIMESTAMP WITH TIME ZONE, 
    225         target_copy             BIGINT                          NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE, 
    226         source                  INT                             NOT NULL REFERENCES actor.org_unit (id), 
    227         dest                    INT                             NOT NULL REFERENCES actor.org_unit (id), 
    228         prev_hop                INT                             REFERENCES action.transit_copy (id), 
    229         copy_status             INT                             NOT NULL REFERENCES config.copy_status (id), 
     225        target_copy             BIGINT                          NOT NULL REFERENCES asset.copy (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 
     226        source                  INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     227        dest                    INT                             NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 
     228        prev_hop                INT                             REFERENCES action.transit_copy (id) DEFERRABLE INITIALLY DEFERRED, 
     229        copy_status             INT                             NOT NULL REFERENCES config.copy_status (id) DEFERRABLE INITIALLY DEFERRED, 
    230230        persistant_transfer     BOOL                            NOT NULL DEFAULT FALSE 
    231231); 
     
    239239) INHERITS (action.transit_copy); 
    240240ALTER TABLE action.hold_transit_copy ADD PRIMARY KEY (id); 
    241 ALTER TABLE action.hold_transit_copy ADD CONSTRAINT ahtc_tc_fkey FOREIGN KEY (target_copy) REFERENCES asset.copy (id) ON DELETE CASCADE; 
     241ALTER TABLE action.hold_transit_copy ADD CONSTRAINT ahtc_tc_fkey FOREIGN KEY (target_copy) REFERENCES asset.copy (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; 
    242242CREATE INDEX active_hold_transit_dest_idx ON "action".hold_transit_copy (dest); 
    243243CREATE INDEX active_hold_transit_source_idx ON "action".hold_transit_copy (source); 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/1.2.1-1.2.2-upgrade-db.sql

    r9529 r9543  
    171171    id          SERIAL  PRIMARY KEY, 
    172172    active      BOOL    NOT NULL DEFAULT TRUE, 
    173     field       INT     NOT NULL REFERENCES config.metabib_field (id), 
     173    field       INT     NOT NULL REFERENCES config.metabib_field (id) DEFERRABLE INITIALLY DEFERRED, 
    174174    bump_type   TEXT    NOT NULL CHECK (bump_type IN ('word_order','first_word','full_match')), 
    175175    multiplier  NUMERIC NOT NULL DEFAULT 1.0 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/300.schema.staged_search.sql

    r9147 r9543  
    99    id          SERIAL  PRIMARY KEY, 
    1010    active      BOOL    NOT NULL DEFAULT TRUE, 
    11     field       INT     NOT NULL REFERENCES config.metabib_field (id), 
     11    field       INT     NOT NULL REFERENCES config.metabib_field (id) DEFERRABLE INITIALLY DEFERRED, 
    1212    bump_type   TEXT    NOT NULL CHECK (bump_type IN ('word_order','first_word','full_match')), 
    1313    multiplier  NUMERIC NOT NULL DEFAULT 1.0 
  • branches/rel_1_2/Open-ILS/src/sql/Pg/reporter-schema.sql

    r9475 r9543  
    5252        description     TEXT                            NOT NULL, 
    5353        data            TEXT                            NOT NULL, 
    54         folder          INT                             NOT NULL REFERENCES reporter.template_folder (id) 
     54        folder          INT                             NOT NULL REFERENCES reporter.template_folder (id) DEFERRABLE INITIALLY DEFERRED 
    5555); 
    5656CREATE INDEX rpt_tmpl_owner_idx ON reporter.template (owner); 
     
    6666        template        INT                             NOT NULL REFERENCES reporter.template (id) DEFERRABLE INITIALLY DEFERRED, 
    6767        data            TEXT                            NOT NULL, 
    68         folder          INT                             NOT NULL REFERENCES reporter.report_folder (id), 
     68        folder          INT                             NOT NULL REFERENCES reporter.report_folder (id) DEFERRABLE INITIALLY DEFERRED, 
    6969        recur           BOOL                            NOT NULL DEFAULT FALSE, 
    7070        recurance       INTERVAL 
     
    7777        id              SERIAL                          PRIMARY KEY, 
    7878        report          INT                             NOT NULL REFERENCES reporter.report (id) DEFERRABLE INITIALLY DEFERRED, 
    79         folder          INT                             NOT NULL REFERENCES reporter.output_folder (id), 
     79        folder          INT                             NOT NULL REFERENCES reporter.output_folder (id) DEFERRABLE INITIALLY DEFERRED, 
    8080        runner          INT                             NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 
    8181        run_time        TIMESTAMP WITH TIME ZONE        NOT NULL DEFAULT NOW(),