Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| id | int8 | 19 | √ | null | 
                                         | 
                                    
                                         | 
                                    |||||
| batch_id | int8 | 19 | null | 
                                         | 
                                    
                                        
  | 
                                    Which batch’s quantities were changed.  | 
                                |||||
| history_type_id | int4 | 10 | null | 
                                         | 
                                    
                                        
  | 
                                    Type of operation that resulted in the change in quantities.  | 
                                |||||
| created_by | int8 | 19 | null | 
                                         | 
                                    
                                        
  | 
                                    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 | 
                                         | 
                                    
                                        
  | 
                                    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.  | 
                                
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_not_ready_quantity_check | (active_growth_quantity >= 0) | 
| batch_quantity_history_ready_quantity_check | (ready_quantity >= 0) | 
| batch_quantity_history_germinating_quantity_check | (germinating_quantity >= 0) |