batch_quantity_history

-1 rows


Description

Record of changes of seedling quantities in each nursery batch.

Columns

Column Type Size Nulls Auto Default Children Parents Comments
id int8 19 null
batch_id int8 19 null
batches.id batch_quantity_history_batch_id_fkey C

Which batch’s quantities were changed.

history_type_id int4 10 null
batch_quantity_history_types.id batch_quantity_history_history_type_id_fkey R

Type of operation that resulted in the change in quantities.

created_by int8 19 null
users.id batch_quantity_history_created_by_fkey R

Which user triggered the change in quantities. “Created” here refers to the history row, not the batch.

created_time timestamptz 35,6 null

When the change in quantities happened. “Created” here refers to the history row, not the batch.

germinating_quantity int4 10 null

New number of germinating seedlings in the batch.

active_growth_quantity int4 10 null

New number of active-growth-for-planting seedlings in the batch.

ready_quantity int4 10 null

New number of ready-for-planting seedlings in the batch.

withdrawal_id int8 19 null
withdrawals.id batch_quantity_history_withdrawal_id_fkey C

If this change in quantity was due to a withdrawal from the batch, the withdrawal’s ID.

version int4 10 null
hardening_off_quantity int4 10 0

New number of hardening-off seedlings in the batch.

notes text 2147483647 null
accession_id int8 19 null
accessions.id batch_quantity_history_accession_id_fkey N

If this change in quantity was due to a transfer of seeds from an accession, the accession’s ID. This may differ from the accession ID of the batch itself if seeds from more than one accession were added to the batch.

Indexes

Constraint Name Type Sort Column(s)
batch_quantity_history_pkey Primary key Asc id
batch_quantity_history_accession_id_idx Performance Asc accession_id
batch_quantity_history_batch_id_idx Performance Asc batch_id
batch_quantity_history_batch_id_version_key Must be unique Asc/Asc batch_id + version

Check Constraints

Constraint Name Constraint
batch_quantity_history_not_ready_quantity_check (active_growth_quantity >= 0)
batch_quantity_history_germinating_quantity_check (germinating_quantity >= 0)
batch_quantity_history_ready_quantity_check (ready_quantity >= 0)

Relationships