withdrawals

0 rows


Description

Top-level information about a withdrawal from a nursery. Does not contain withdrawal quantities; those are in the batch_withdrawals table.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int8 19 null
batch_quantity_history.withdrawal_id batch_quantity_history_withdrawal_id_fkeyC
batch_withdrawals.withdrawal_id batch_withdrawals_withdrawal_id_fkeyC
withdrawal_photos.withdrawal_id withdrawal_photos_withdrawal_id_fkeyR
withdrawals.undoes_withdrawal_id withdrawals_undoes_withdrawal_id_fkeyC
deliveries.withdrawal_id deliveries_withdrawal_id_fkeyC
facility_id int8 19 null
facilities.id withdrawals_facility_id_fkeyC

Nursery from which the seedlings were withdrawn.

purpose_id int4 10 null
withdrawal_purposes.id withdrawals_purpose_id_fkeyR

Purpose of the withdrawal (nursery transfer, dead seedlings, etc.)

withdrawn_date date 13 null

User-supplied date when the seedlings were withdrawn.

created_by int8 19 null
users.id withdrawals_created_by_fkeyR

Which user created the withdrawal.

created_time timestamptz 35,6 null

When the withdrawal was created.

modified_by int8 19 null
users.id withdrawals_modified_by_fkeyR

Which user most recently modified the withdrawal.

modified_time timestamptz 35,6 null

When the withdrawal was most recently modified.

destination_facility_id int8 19 null
facilities.id withdrawals_destination_facility_id_fkeyN

If the withdrawal was a nursery transfer, the facility where the seedlings were sent. May be null if the facility was subsequently deleted.

notes text 2147483647 null

User-supplied freeform text describing the withdrawal.

undoes_withdrawal_id int8 19 null
withdrawals.id withdrawals_undoes_withdrawal_id_fkeyC

Indexes

Constraint Name Type Sort Column(s)
withdrawals_pkey Primary key Asc id
withdrawals_destination_facility_id_idx Performance Asc destination_facility_id
withdrawals_facility_id_idx Performance Asc facility_id
withdrawals_undoes_withdrawal_id_key Must be unique Asc undoes_withdrawal_id

Check Constraints

Constraint Name Constraint
withdrawals_destination_only_for_transfers (((destination_facility_id IS NULL) OR (purpose_id = 1)))
undo_requires_withdrawal_id ((((purpose_id = 5) AND (undoes_withdrawal_id IS NOT NULL)) OR ((purpose_id <> 5) AND (undoes_withdrawal_id IS NULL))))
withdrawals_notes_check ((notes !~ similar_to_escape(' *'::text)))

Relationships