CREATE SEQUENCE action.survey_response_group_id_seq;
CREATE TABLE action.survey_response (
- id BIGSERIAL PRIMARY KEY,
+ id BIGSERIAL PRIMARY KEY,
response_group_id INT,
- usr INT, -- REFERENCES actor.usr
- survey INT NOT NULL REFERENCES action.survey,
- question INT NOT NULL REFERENCES action.survey_question,
- answer INT NOT NULL REFERENCES action.survey_answer,
- answer_date TIMESTAMP WITH TIME ZONE,
- effective_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
+ usr INT, -- REFERENCES actor.usr
+ survey INT NOT NULL REFERENCES action.survey,
+ question INT NOT NULL REFERENCES action.survey_question,
+ answer INT NOT NULL REFERENCES action.survey_answer,
+ answer_date TIMESTAMP WITH TIME ZONE,
+ effective_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
CREATE OR REPLACE FUNCTION action.survey_response_answer_date_fixup () RETURNS TRIGGER AS '
BEGIN
CREATE TABLE action.circulation (
- target_copy BIGINT NOT NULL, -- asset.copy.id
- circ_lib INT NOT NULL, -- actor.org_unit.id
- duration_rule TEXT NOT NULL, -- name of "circ duration" rule
- duration INTERVAL NOT NULL, -- derived from "circ duration" rule
- renewal_remaining INT NOT NULL, -- derived from "circ duration" rule
- recuring_fine_rule TEXT NOT NULL, -- name of "circ fine" rule
- recuring_fine NUMERIC(6,2) NOT NULL, -- derived from "circ fine" rule
- max_fine_rule TEXT NOT NULL, -- name of "max fine" rule
- max_fine NUMERIC(6,2) NOT NULL, -- derived from "max fine" rule
- fine_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule
- stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES'))
+ target_copy BIGINT NOT NULL, -- asset.copy.id
+ circ_lib INT NOT NULL, -- actor.org_unit.id
+ duration_rule TEXT NOT NULL, -- name of "circ duration" rule
+ duration INTERVAL NOT NULL, -- derived from "circ duration" rule
+ renewal_remaining INT NOT NULL, -- derived from "circ duration" rule
+ recuring_fine_rule TEXT NOT NULL, -- name of "circ fine" rule
+ recuring_fine NUMERIC(6,2) NOT NULL, -- derived from "circ fine" rule
+ max_fine_rule TEXT NOT NULL, -- name of "max fine" rule
+ max_fine NUMERIC(6,2) NOT NULL, -- derived from "max fine" rule
+ fine_interval INTERVAL NOT NULL DEFAULT '1 day'::INTERVAL, -- derived from "circ fine" rule
+ due_date TIMESTAMP WITH TIME ZONE NOT NULL,
+ stop_fines TEXT CHECK (stop_fines IN ('CHECKIN','CLAIMSRETURNED','LOST','MAXFINES'))
) INHERITS (money.billable_xact);
CREATE INDEX circ_open_xacts_idx ON action.circulation (usr) WHERE xact_finish IS NULL;
+CREATE TABLE action.hold_request (
+ id SERIAL PRIMARY KEY,
+ request_time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ capture_time TIMESTAMP WITH TIME ZONE,
+ fulfillment_time TIMESTAMP WITH TIME ZONE,
+ prev_check_time TIMESTAMP WITH TIME ZONE,
+ expire_time TIMESTAMP WITH TIME ZONE,
+ requestor INT NOT NULL REFERENCES actor.usr (id),
+ usr INT NOT NULL REFERENCES actor.usr (id),
+ hold_type CHAR NOT NULL CHECK (hold_type IN ('M','T','V','C')),
+ holdable_formats TEXT,
+ target BIGINT NOT NULL, -- see hold_type
+ selection_depth INT NOT NULL DEFAULT 0,
+ pickup_lib INT NOT NULL REFERENCES actor.org_unit,
+ current_copy BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL
+);
+
+
+CREATE TABLE action.hold_notification (
+ id SERIAL PRIMARY KEY,
+ hold INT NOT NULL REFERENCES action.hold_request (id),
+ method TEXT NOT NULL, -- eh...
+ notify_time TIMESTAMP NOT NULL DEFAULT NOW(),
+ note TEXT
+);
+
+
+
COMMIT;