Changeset 9542 for trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
- Timestamp:
- 05/09/08 12:31:09 (2 months ago)
- Files:
-
- 1 modified
-
trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Open-ILS/src/sql/Pg/005.schema.actors.sql
r9243 r9542 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, … … 135 135 CREATE TABLE actor.usr_note ( 136 136 id BIGSERIAL PRIMARY KEY, 137 usr BIGINT NOT NULL REFERENCES actor.usr ON DELETE CASCADE ,138 creator BIGINT NOT NULL REFERENCES actor.usr ON DELETE CASCADE ,137 usr BIGINT NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 138 creator BIGINT NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 139 139 create_date TIMESTAMP WITH TIME ZONE DEFAULT NOW(), 140 140 pub BOOL NOT NULL DEFAULT FALSE, … … 146 146 CREATE TABLE actor.usr_standing_penalty ( 147 147 id SERIAL PRIMARY KEY, 148 usr INT NOT NULL REFERENCES actor.usr ON DELETE CASCADE ,148 usr INT NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 149 149 penalty_type TEXT NOT NULL 150 150 ); … … 174 174 CREATE TABLE actor.usr_setting ( 175 175 id BIGSERIAL PRIMARY KEY, 176 usr INT NOT NULL REFERENCES actor.usr ON DELETE CASCADE ,176 usr INT NOT NULL REFERENCES actor.usr ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 177 177 name TEXT NOT NULL, 178 178 value TEXT NOT NULL, … … 307 307 CREATE TABLE actor.card ( 308 308 id SERIAL PRIMARY KEY, 309 usr INT NOT NULL REFERENCES actor.usr (id) ,309 usr INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 310 310 barcode TEXT NOT NULL UNIQUE, 311 311 active BOOL NOT NULL DEFAULT TRUE … … 345 345 opac_label TEXT NOT NULL, 346 346 depth INT NOT NULL, 347 parent INT REFERENCES actor.org_unit_type (id) ,347 parent INT REFERENCES actor.org_unit_type (id) DEFERRABLE INITIALLY DEFERRED, 348 348 can_have_vols BOOL NOT NULL DEFAULT TRUE, 349 349 can_have_users BOOL NOT NULL DEFAULT TRUE … … 353 353 CREATE TABLE actor.org_unit ( 354 354 id SERIAL PRIMARY KEY, 355 parent_ou INT REFERENCES actor.org_unit (id) ,356 ou_type INT NOT NULL REFERENCES actor.org_unit_type (id) ,355 parent_ou INT REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 356 ou_type INT NOT NULL REFERENCES actor.org_unit_type (id) DEFERRABLE INITIALLY DEFERRED, 357 357 ill_address INT, 358 358 holds_address INT, … … 379 379 CREATE TABLE actor.org_lasso_map ( 380 380 id SERIAL PRIMARY KEY, 381 lasso INT NOT NULL REFERENCES actor.org_lasso (id) ON DELETE CASCADE ,382 org_unit INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE 381 lasso INT NOT NULL REFERENCES actor.org_lasso (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 382 org_unit INT NOT NULL REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED 383 383 ); 384 384 CREATE UNIQUE INDEX ou_lasso_lasso_ou_idx ON actor.org_lasso_map (lasso, org_unit); … … 394 394 395 395 CREATE TABLE actor.hours_of_operation ( 396 id INT PRIMARY KEY REFERENCES actor.org_unit (id) ON DELETE CASCADE ,396 id INT PRIMARY KEY REFERENCES actor.org_unit (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 397 397 dow_0_open TIME NOT NULL DEFAULT '09:00', 398 398 dow_0_close TIME NOT NULL DEFAULT '17:00', … … 413 413 CREATE TABLE actor.org_unit_closed ( 414 414 id SERIAL PRIMARY KEY, 415 org_unit INT NOT NULL REFERENCES actor.org_unit (id) ,415 org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 416 416 close_start TIMESTAMP WITH TIME ZONE NOT NULL, 417 417 close_end TIMESTAMP WITH TIME ZONE NOT NULL, … … 423 423 id SERIAL PRIMARY KEY, 424 424 name TEXT NOT NULL UNIQUE, 425 owning_lib INT NOT NULL REFERENCES actor.org_unit (id) 425 owning_lib INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED 426 426 ); 427 427 428 428 CREATE TABLE actor.usr_org_unit_opt_in ( 429 429 id SERIAL PRIMARY KEY, 430 org_unit INT NOT NULL REFERENCES actor.org_unit (id) ,431 usr INT NOT NULL REFERENCES actor.usr (id) ,432 staff INT NOT NULL REFERENCES actor.usr (id) ,430 org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 431 usr INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 432 staff INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 433 433 opt_in_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), 434 opt_in_ws INT NOT NULL REFERENCES actor.workstation (id) ,434 opt_in_ws INT NOT NULL REFERENCES actor.workstation (id) DEFERRABLE INITIALLY DEFERRED, 435 435 CONSTRAINT usr_opt_in_once_per_org_unit UNIQUE (usr,org_unit) 436 436 ); … … 438 438 CREATE TABLE actor.org_unit_setting ( 439 439 id BIGSERIAL PRIMARY KEY, 440 org_unit INT NOT NULL REFERENCES actor.org_unit ON DELETE CASCADE ,440 org_unit INT NOT NULL REFERENCES actor.org_unit ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, 441 441 name TEXT NOT NULL, 442 442 value TEXT NOT NULL, … … 475 475 within_city_limits BOOL NOT NULL DEFAULT TRUE, 476 476 address_type TEXT NOT NULL DEFAULT 'MAILING', 477 usr INT NOT NULL REFERENCES actor.usr (id) ,477 usr INT NOT NULL REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED, 478 478 street1 TEXT NOT NULL, 479 479 street2 TEXT, … … 499 499 valid BOOL NOT NULL DEFAULT TRUE, 500 500 address_type TEXT NOT NULL DEFAULT 'MAILING', 501 org_unit INT NOT NULL REFERENCES actor.org_unit (id) ,501 org_unit INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED, 502 502 street1 TEXT NOT NULL, 503 503 street2 TEXT,
