Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| id | int8 | 19 | √ | null | 
                                        
  | 
                                    
                                         | 
                                    ||||||||||||||||||||||||||||||||||||||||||||||||||
| planting_site_id | int8 | 19 | null | 
                                         | 
                                    
                                        
  | 
                                    |||||||||||||||||||||||||||||||||||||||||||||||||||
| created_time | timestamptz | 35,6 | null | 
                                         | 
                                    
                                         | 
                                    |||||||||||||||||||||||||||||||||||||||||||||||||||
| start_date | date | 13 | null | 
                                         | 
                                    
                                         | 
                                    First day of the observation. This is either the first day of the month following the end of the planting season, or 6 months after that day.  | 
                                ||||||||||||||||||||||||||||||||||||||||||||||||||
| end_date | date | 13 | null | 
                                         | 
                                    
                                         | 
                                    Last day of the observation. This is typically the last day of the same month as   | 
                                ||||||||||||||||||||||||||||||||||||||||||||||||||
| completed_time | timestamptz | 35,6 | √ | null | 
                                         | 
                                    
                                         | 
                                    Server-generated date and time the final piece of data for the observation was received.  | 
                                |||||||||||||||||||||||||||||||||||||||||||||||||
| state_id | int4 | 10 | null | 
                                         | 
                                    
                                        
  | 
                                    |||||||||||||||||||||||||||||||||||||||||||||||||||
| upcoming_notification_sent_time | timestamptz | 35,6 | √ | null | 
                                         | 
                                    
                                         | 
                                    When the notification that the observation is starting in 1 month was sent. Null if the notification has not been sent yet.  | 
                                |||||||||||||||||||||||||||||||||||||||||||||||||
| planting_site_history_id | int8 | 19 | √ | null | 
                                         | 
                                    
                                        
  | 
                                    Which version of the planting site map was used for the observation. Null for upcoming observations since monitoring plots are only placed on the map when an observation starts.  | 
                                |||||||||||||||||||||||||||||||||||||||||||||||||
| observation_type_id | int4 | 10 | null | 
                                         | 
                                    
                                        
  | 
                                    |||||||||||||||||||||||||||||||||||||||||||||||||||
| is_ad_hoc | bool | 1 | null | 
                                         | 
                                    
                                         | 
                                    
Indexes
| Constraint Name | Type | Sort | Column(s) | 
|---|---|---|---|
| observations_pkey | Primary key | Asc | id | 
| observations_planting_site_history_id_idx | Performance | Asc | planting_site_history_id | 
| observations_planting_site_id_idx | Performance | Asc | planting_site_id | 
Check Constraints
| Constraint Name | Constraint | 
|---|---|
| end_after_start | (start_date <= end_date) | 
| history_id_required_at_start | (((state_id = 1) AND (planting_site_history_id IS NULL)) OR ((state_id <> 1) AND (planting_site_history_id IS NOT NULL))) | 
| completed_time_and_state | (((completed_time IS NULL) AND (state_id <> ALL (ARRAY[3, 5]))) OR ((completed_time IS NOT NULL) AND (state_id = ANY (ARRAY[3, 5])))) |