Columns
Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | int8 | 19 | null |
|
|
|||||||||
delivery_id | int8 | 19 | null |
|
|
Which delivery this planting is part of. |
||||||||
planting_type_id | int4 | 10 | null |
|
|
Whether this is the plant assignment from the initial delivery or an adjustment from a reassignment. |
||||||||
planting_site_id | int8 | 19 | null |
|
|
Which planting site has the planting. Must be the same as the planting site ID of the delivery. This identifies the site as a whole; in addition, there may be a plot ID. |
||||||||
planting_subzone_id | int8 | 19 | √ | null |
|
|
Which plot this planting affected, if any. Must be a plot at the planting site referenced by |
|||||||
species_id | int8 | 19 | null |
|
|
Which species was planted. |
||||||||
created_by | int8 | 19 | null |
|
|
Which user created the planting. |
||||||||
created_time | timestamptz | 35,6 | null |
|
|
When the planting was created. Note that plantings are never updated, so there is no modified time. |
||||||||
num_plants | int4 | 10 | null |
|
|
Number of plants that were planted (if the number is positive) or reassigned (if the number is negative). |
||||||||
notes | text | 2147483647 | √ | null |
|
|
Notes about this specific planting. In the initial version of the web app, the user can only enter per-planting notes for reassignments, not for initial deliveries. |
Indexes
Constraint Name | Type | Sort | Column(s) |
---|---|---|---|
plantings_pkey | Primary key | Asc | id |
plantings_delivery_id_idx | Performance | Asc | delivery_id |
plantings_delivery_id_species_id_planting_type_id_key | Must be unique | Asc/Asc/Asc | delivery_id + species_id + planting_type_id |
plantings_plot_id_idx | Performance | Asc | planting_subzone_id |
plantings_species_id_idx | Performance | Asc | species_id |
Check Constraints
Constraint Name | Constraint |
---|---|
num_plants_sign_consistent_with_type | ((((planting_type_id = ANY (ARRAY[2, 4])) AND (num_plants < 0)) OR ((planting_type_id <> ALL (ARRAY[2, 4])) AND (num_plants > 0)))) |
plantings_notes_check | ((notes !~ similar_to_escape(' *'::text))) |