booking.reservation

Cascading Deletes: Deleting rows from this table will cascade to: booking.resource, booking.resource, booking.resource_type.

Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: booking_reservation_usr_fkey, reservation_capture_staff_fkey, reservation_current_resource_fkey, reservation_pickup_lib_fkey, reservation_request_lib_fkey, reservation_target_resource_fkey, reservation_target_resource_type_fkey.

Trigger Side Effects: Writing to this table automatically triggers writes to other tables:

Columns

Column Type Nullable Default Notes

id PK

bigint

No

nextval('money.billable_xact_id_seq'::regclass)

usr FK

integer

No

actor.usr(id)

xact_start

timestamp with time zone

No

now()

xact_finish

timestamp with time zone

Yes

unrecovered

boolean

Yes

request_time

timestamp with time zone

No

now()

start_time

timestamp with time zone

Yes

end_time

timestamp with time zone

Yes

capture_time

timestamp with time zone

Yes

cancel_time

timestamp with time zone

Yes

pickup_time

timestamp with time zone

Yes

return_time

timestamp with time zone

Yes

booking_interval

interval

Yes

fine_interval

interval

Yes

fine_amount

numeric(8,2)

Yes

max_fine

numeric(8,2)

Yes

target_resource_type FK

integer

No

booking.resource_type(id)

target_resource FK

integer

Yes

booking.resource(id)

current_resource FK

integer

Yes

booking.resource(id)

request_lib FK

integer

No

actor.org_unit(id)

pickup_lib FK

integer

Yes

actor.org_unit(id)

capture_staff FK

integer

Yes

actor.usr(id)

email_notify

boolean

No

false

note

text

Yes

Primary Key

(id)

Foreign Keys

Column(s) References On Delete On Update Deferrable Constraint

usr

actor.usr(id)

NO ACTION

NO ACTION

DEFERRED

booking_reservation_usr_fkey

capture_staff

actor.usr(id)

NO ACTION

NO ACTION

DEFERRED

reservation_capture_staff_fkey

current_resource

booking.resource(id)

CASCADE

NO ACTION

DEFERRED

reservation_current_resource_fkey

pickup_lib

actor.org_unit(id)

NO ACTION

NO ACTION

DEFERRED

reservation_pickup_lib_fkey

request_lib

actor.org_unit(id)

NO ACTION

NO ACTION

DEFERRED

reservation_request_lib_fkey

target_resource

booking.resource(id)

CASCADE

NO ACTION

DEFERRED

reservation_target_resource_fkey

target_resource_type

booking.resource_type(id)

CASCADE

NO ACTION

DEFERRED

reservation_target_resource_type_fkey

Indexes

Index Method Definition

reservation_pkey PK

btree

CREATE UNIQUE INDEX reservation_pkey ON booking.reservation USING btree (id)

Triggers

Trigger Timing Event Level Function

mat_summary_change_tgr

AFTER

UPDATE

ROW

money.mat_summary_update()

mat_summary_create_tgr

AFTER

INSERT

ROW

money.mat_summary_create()

mat_summary_remove_tgr

AFTER

DELETE

ROW

money.mat_summary_delete()

Trigger Bodies

mat_summary_change_tgr

Function: money.mat_summary_update()
Timing: AFTER UPDATE ROW

BEGIN
	UPDATE	money.materialized_billable_xact_summary
	  SET	usr = NEW.usr,
		xact_start = NEW.xact_start,
		xact_finish = NEW.xact_finish
	  WHERE	id = NEW.id;
	RETURN NEW;
END;

mat_summary_create_tgr

Function: money.mat_summary_create()
Timing: AFTER INSERT ROW

BEGIN
	INSERT INTO money.materialized_billable_xact_summary (id, usr, xact_start, xact_finish, total_paid, total_owed, balance_owed, xact_type)
		VALUES ( NEW.id, NEW.usr, NEW.xact_start, NEW.xact_finish, 0.0, 0.0, 0.0, TG_ARGV[0]);
	RETURN NEW;
END;

mat_summary_remove_tgr

Function: money.mat_summary_delete()
Timing: AFTER DELETE ROW

BEGIN
	DELETE FROM money.materialized_billable_xact_summary WHERE id = OLD.id;
	RETURN OLD;
END;

Referenced By

The following tables have foreign keys pointing to booking.reservation (3 referencing table(s)):

Table Referencing Column(s) Referenced Column(s) Constraint

action.emergency_closing_reservation

reservation

id

emergency_closing_reservation_reservation_fkey

action.reservation_transit_copy

reservation

id

reservation_transit_copy_reservation_fkey

booking.reservation_attr_value_map

reservation

id

reservation_attr_value_map_reservation_fkey