batch_quantity_history

0 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_fkeyC

Which batch’s quantities were changed.

history_type_id int4 10 null
batch_quantity_history_types.id batch_quantity_history_history_type_id_fkeyR

Type of operation that resulted in the change in quantities.

created_by int8 19 null
users.id batch_quantity_history_created_by_fkeyR

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.

not_ready_quantity int4 10 null

New number of not-ready-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_fkeyC

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

version int4 10 null

Indexes

Constraint Name Type Sort Column(s)
batch_quantity_history_pkey Primary key Asc 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_germinating_quantity_check ((germinating_quantity >= 0))
batch_quantity_history_not_ready_quantity_check ((not_ready_quantity >= 0))
batch_quantity_history_ready_quantity_check ((ready_quantity >= 0))

Relationships