- Timestamp:
- 05/09/08 12:34:30 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/rel_1_2/Open-ILS/src/sql/Pg/005.schema.actors.sql
r9242 r9543 33 33 email TEXT, 34 34 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, 37 37 ident_value TEXT, 38 ident_type2 INT REFERENCES config.identification_type (id) ,38 ident_type2 INT REFERENCES config.identification_type (id) DEFERRABLE INITIALLY DEFERRED, 39 39 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, 41 41 photo_url TEXT, 42 42 prefix TEXT, … … 139 139 CREATE TABLE actor.usr_note ( 140 140 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, 143 143 create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), 144 144 pub BOOL NOT NULL DEFAULT FALSE, … … 150 150 CREATE TABLE actor.usr_standing_penalty ( 151 151 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, 153 153 penalty_type TEXT NOT NULL 154 154 ); … … 178 178 CREATE TABLE actor.usr_setting ( 179 179 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, 181 181 name TEXT NOT NULL, 182 182 value TEXT NOT NULL, … … 311 311 CREATE TABLE actor.card ( 312 312 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, 314 314 barcode TEXT NOT NULL UNIQUE, 315 315 active BOOL NOT NULL DEFAULT TRUE … … 352 352 opac_label TEXT NOT NULL, 353 353 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, 355 355 can_have_vols BOOL NOT NULL DEFAULT TRUE, 356 356 can_have_users BOOL NOT NULL DEFAULT TRUE … … 367 367 CREATE TABLE actor.org_unit ( 368 368 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, 371 371 ill_address INT, 372 372 holds_address INT, … … 405 405 406 406 CREATE 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, 408 408 dow_0_open TIME NOT NULL DEFAULT '09:00', 409 409 dow_0_close TIME NOT NULL DEFAULT '17:00', … … 424 424 CREATE TABLE actor.org_unit_closed ( 425 425 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, 427 427 close_start TIMESTAMP WITH TIME ZONE NOT NULL, 428 428 close_end TIMESTAMP WITH TIME ZONE NOT NULL, … … 434 434 id SERIAL PRIMARY KEY, 435 435 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 437 437 ); 438 438 439 439 CREATE TABLE actor.usr_org_unit_opt_in ( 440 440 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, 444 444 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, 446 446 CONSTRAINT usr_opt_in_once_per_org_unit UNIQUE (usr,org_unit) 447 447 ); … … 449 449 CREATE TABLE actor.org_unit_setting ( 450 450 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, 452 452 name TEXT NOT NULL, 453 453 value TEXT NOT NULL, … … 486 486 within_city_limits BOOL NOT NULL DEFAULT TRUE, 487 487 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, 489 489 street1 TEXT NOT NULL, 490 490 street2 TEXT, … … 510 510 valid BOOL NOT NULL DEFAULT TRUE, 511 511 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, 513 513 street1 TEXT NOT NULL, 514 514 street2 TEXT,
