Add bilingual native_range and wildlife_value fields (DE/EN) to species
Migration 011 adds native_range_de, native_range_en, wildlife_value_de, wildlife_value_en columns. Backend INSERT/UPDATE queries updated ($64→$68). Frontend species and cultivar detail pages use pick_desc() for language selection.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE species ADD COLUMN IF NOT EXISTS native_range_de TEXT;
|
||||
ALTER TABLE species ADD COLUMN IF NOT EXISTS native_range_en TEXT;
|
||||
ALTER TABLE species ADD COLUMN IF NOT EXISTS wildlife_value_de TEXT;
|
||||
ALTER TABLE species ADD COLUMN IF NOT EXISTS wildlife_value_en TEXT;
|
||||
@@ -110,6 +110,8 @@ pub struct Species {
|
||||
pub other_uses_de: Option<String>,
|
||||
pub other_uses_en: Option<String>,
|
||||
pub native_range: Option<String>,
|
||||
pub native_range_de: Option<String>,
|
||||
pub native_range_en: Option<String>,
|
||||
pub invasiveness: Option<String>,
|
||||
pub pollination_type: Option<String>,
|
||||
pub plant_layer: Option<String>,
|
||||
@@ -119,6 +121,8 @@ pub struct Species {
|
||||
pub attracts_pollinators: Option<bool>,
|
||||
pub attracts_beneficial_insects: Option<bool>,
|
||||
pub wildlife_value: Option<String>,
|
||||
pub wildlife_value_de: Option<String>,
|
||||
pub wildlife_value_en: Option<String>,
|
||||
pub mulch_plant: Option<bool>,
|
||||
pub ground_cover_quality: Option<String>,
|
||||
pub allelopathic: Option<bool>,
|
||||
@@ -179,6 +183,8 @@ pub struct CreateSpecies {
|
||||
pub other_uses_de: Option<String>,
|
||||
pub other_uses_en: Option<String>,
|
||||
pub native_range: Option<String>,
|
||||
pub native_range_de: Option<String>,
|
||||
pub native_range_en: Option<String>,
|
||||
pub invasiveness: Option<String>,
|
||||
pub pollination_type: Option<String>,
|
||||
pub plant_layer: Option<String>,
|
||||
@@ -188,6 +194,8 @@ pub struct CreateSpecies {
|
||||
pub attracts_pollinators: Option<bool>,
|
||||
pub attracts_beneficial_insects: Option<bool>,
|
||||
pub wildlife_value: Option<String>,
|
||||
pub wildlife_value_de: Option<String>,
|
||||
pub wildlife_value_en: Option<String>,
|
||||
pub mulch_plant: Option<bool>,
|
||||
pub ground_cover_quality: Option<String>,
|
||||
pub allelopathic: Option<bool>,
|
||||
|
||||
@@ -109,9 +109,12 @@ pub async fn create(pool: &PgPool, req: &CreateSpecies) -> Result<Species> {
|
||||
food_uses, food_uses_de, food_uses_en,
|
||||
medicinal_uses, medicinal_uses_de, medicinal_uses_en,
|
||||
other_uses, other_uses_de, other_uses_en,
|
||||
native_range, invasiveness, pollination_type,
|
||||
native_range, native_range_de, native_range_en,
|
||||
invasiveness, pollination_type,
|
||||
plant_layer, nitrogen_fixer, dynamic_accumulator, dynamic_accumulator_nutrients,
|
||||
attracts_pollinators, attracts_beneficial_insects, wildlife_value, mulch_plant,
|
||||
attracts_pollinators, attracts_beneficial_insects,
|
||||
wildlife_value, wildlife_value_de, wildlife_value_en,
|
||||
mulch_plant,
|
||||
ground_cover_quality, allelopathic, guild_role, succession_stage, heavy_metal_tolerance,
|
||||
wikidata_qid, gbif_id, eppo_code, pfaf_url, source_urls,
|
||||
nectar_value, pollen_value, wild_bee_count, wild_bee_specialist_count,
|
||||
@@ -119,10 +122,10 @@ pub async fn create(pool: &PgPool, req: &CreateSpecies) -> Result<Species> {
|
||||
hoverfly_count, beetle_count, bird_count, mammal_count,
|
||||
native_status, naturadb_tags)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,
|
||||
$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,
|
||||
$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,
|
||||
$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,
|
||||
$58,$59,$60,$61,$62,$63,$64)
|
||||
$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,
|
||||
$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,
|
||||
$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,
|
||||
$60,$61,$62,$63,$64,$65,$66,$67,$68)
|
||||
RETURNING *"
|
||||
)
|
||||
.bind(id).bind(&slug).bind(req.family_id).bind(&req.name_scientific)
|
||||
@@ -136,11 +139,13 @@ pub async fn create(pool: &PgPool, req: &CreateSpecies) -> Result<Species> {
|
||||
.bind(&req.food_uses).bind(&req.food_uses_de).bind(&req.food_uses_en)
|
||||
.bind(&req.medicinal_uses).bind(&req.medicinal_uses_de).bind(&req.medicinal_uses_en)
|
||||
.bind(&req.other_uses).bind(&req.other_uses_de).bind(&req.other_uses_en)
|
||||
.bind(&req.native_range).bind(&req.invasiveness).bind(&req.pollination_type)
|
||||
.bind(&req.native_range).bind(&req.native_range_de).bind(&req.native_range_en)
|
||||
.bind(&req.invasiveness).bind(&req.pollination_type)
|
||||
.bind(&req.plant_layer).bind(req.nitrogen_fixer).bind(req.dynamic_accumulator)
|
||||
.bind(&req.dynamic_accumulator_nutrients)
|
||||
.bind(req.attracts_pollinators).bind(req.attracts_beneficial_insects)
|
||||
.bind(&req.wildlife_value).bind(req.mulch_plant)
|
||||
.bind(&req.wildlife_value).bind(&req.wildlife_value_de).bind(&req.wildlife_value_en)
|
||||
.bind(req.mulch_plant)
|
||||
.bind(&req.ground_cover_quality).bind(req.allelopathic).bind(&req.guild_role)
|
||||
.bind(&req.succession_stage).bind(req.heavy_metal_tolerance)
|
||||
.bind(&req.wikidata_qid).bind(&req.gbif_id).bind(&req.eppo_code).bind(&req.pfaf_url)
|
||||
@@ -174,16 +179,18 @@ pub async fn update(pool: &PgPool, id: Uuid, req: &CreateSpecies) -> Result<Spec
|
||||
food_uses=$22, food_uses_de=$23, food_uses_en=$24,
|
||||
medicinal_uses=$25, medicinal_uses_de=$26, medicinal_uses_en=$27,
|
||||
other_uses=$28, other_uses_de=$29, other_uses_en=$30,
|
||||
native_range=$31, invasiveness=$32, pollination_type=$33,
|
||||
plant_layer=$34, nitrogen_fixer=$35, dynamic_accumulator=$36,
|
||||
dynamic_accumulator_nutrients=$37, attracts_pollinators=$38, attracts_beneficial_insects=$39,
|
||||
wildlife_value=$40, mulch_plant=$41, ground_cover_quality=$42, allelopathic=$43,
|
||||
guild_role=$44, succession_stage=$45, heavy_metal_tolerance=$46,
|
||||
wikidata_qid=$47, gbif_id=$48, eppo_code=$49, pfaf_url=$50, source_urls=$51,
|
||||
nectar_value=$52, pollen_value=$53, wild_bee_count=$54, wild_bee_specialist_count=$55,
|
||||
butterfly_moth_count=$56, caterpillar_host_count=$57, caterpillar_specialist_count=$58,
|
||||
hoverfly_count=$59, beetle_count=$60, bird_count=$61, mammal_count=$62,
|
||||
native_status=$63, naturadb_tags=$64,
|
||||
native_range=$31, native_range_de=$32, native_range_en=$33,
|
||||
invasiveness=$34, pollination_type=$35,
|
||||
plant_layer=$36, nitrogen_fixer=$37, dynamic_accumulator=$38,
|
||||
dynamic_accumulator_nutrients=$39, attracts_pollinators=$40, attracts_beneficial_insects=$41,
|
||||
wildlife_value=$42, wildlife_value_de=$43, wildlife_value_en=$44,
|
||||
mulch_plant=$45, ground_cover_quality=$46, allelopathic=$47,
|
||||
guild_role=$48, succession_stage=$49, heavy_metal_tolerance=$50,
|
||||
wikidata_qid=$51, gbif_id=$52, eppo_code=$53, pfaf_url=$54, source_urls=$55,
|
||||
nectar_value=$56, pollen_value=$57, wild_bee_count=$58, wild_bee_specialist_count=$59,
|
||||
butterfly_moth_count=$60, caterpillar_host_count=$61, caterpillar_specialist_count=$62,
|
||||
hoverfly_count=$63, beetle_count=$64, bird_count=$65, mammal_count=$66,
|
||||
native_status=$67, naturadb_tags=$68,
|
||||
updated_at=NOW()
|
||||
WHERE id=$1 RETURNING *"
|
||||
)
|
||||
@@ -198,11 +205,13 @@ pub async fn update(pool: &PgPool, id: Uuid, req: &CreateSpecies) -> Result<Spec
|
||||
.bind(&req.food_uses).bind(&req.food_uses_de).bind(&req.food_uses_en)
|
||||
.bind(&req.medicinal_uses).bind(&req.medicinal_uses_de).bind(&req.medicinal_uses_en)
|
||||
.bind(&req.other_uses).bind(&req.other_uses_de).bind(&req.other_uses_en)
|
||||
.bind(&req.native_range).bind(&req.invasiveness).bind(&req.pollination_type)
|
||||
.bind(&req.native_range).bind(&req.native_range_de).bind(&req.native_range_en)
|
||||
.bind(&req.invasiveness).bind(&req.pollination_type)
|
||||
.bind(&req.plant_layer).bind(req.nitrogen_fixer).bind(req.dynamic_accumulator)
|
||||
.bind(&req.dynamic_accumulator_nutrients)
|
||||
.bind(req.attracts_pollinators).bind(req.attracts_beneficial_insects)
|
||||
.bind(&req.wildlife_value).bind(req.mulch_plant)
|
||||
.bind(&req.wildlife_value).bind(&req.wildlife_value_de).bind(&req.wildlife_value_en)
|
||||
.bind(req.mulch_plant)
|
||||
.bind(&req.ground_cover_quality).bind(req.allelopathic).bind(&req.guild_role)
|
||||
.bind(&req.succession_stage).bind(req.heavy_metal_tolerance)
|
||||
.bind(&req.wikidata_qid).bind(&req.gbif_id).bind(&req.eppo_code).bind(&req.pfaf_url)
|
||||
|
||||
Reference in New Issue
Block a user