From 337199152ddf59aca6538367795ed10f74393a13 Mon Sep 17 00:00:00 2001 From: litefarm-pr-bot <266148868+litefarm-pr-bot@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:10:10 -0700 Subject: [PATCH 1/2] LF-5225 Fix currency validation errors for Belarus and Venezuela MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add BYN (Belarusian ruble, current) to farmModel currency enum alongside legacy BYR (pre-2016 redenomination) for backward compatibility - Add VES (Venezuelan bolívar soberano, current) to enum alongside legacy VEF (pre-2018 redenomination) for backward compatibility - Add migration to align Venezuela ISO in countries table: prod still had deprecated VEF; migration updates to VES, filtered defensively on both country_code and iso so it is a no-op on beta where VES is already present Co-Authored-By: Claude Sonnet 4.6 --- ...260319000000_fix_venezuela_currency_iso.js | 25 +++++++++++++++++++ packages/api/src/models/farmModel.js | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js diff --git a/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js b/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js new file mode 100644 index 0000000000..9221708ea2 --- /dev/null +++ b/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js @@ -0,0 +1,25 @@ +/** + * Aligns Venezuela's currency ISO code in the countries table between environments. + * + * Background: Venezuela redenominated in 2018, replacing the bolívar fuerte (VEF) + * with the bolívar soberano (VES). The beta countries table was updated to VES but + * production was not, leaving prod with the deprecated VEF code. + * + * This migration corrects prod to use VES. The filter on both country_code and iso + * is intentional: it makes the migration safe to run on beta (where iso is already + * VES and the WHERE clause simply matches no rows) without clobbering anything. + * + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +export const up = async function (knex) { + await knex('countries').where({ country_code: 'VE', iso: 'VEF' }).update({ iso: 'VES' }); +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +export const down = async function (knex) { + await knex('countries').where({ country_code: 'VE', iso: 'VES' }).update({ iso: 'VEF' }); +}; diff --git a/packages/api/src/models/farmModel.js b/packages/api/src/models/farmModel.js index 29b73c98a5..576a8bc44c 100644 --- a/packages/api/src/models/farmModel.js +++ b/packages/api/src/models/farmModel.js @@ -82,6 +82,7 @@ class Farm extends baseModel { 'BDT', 'BBD', 'BYR', + 'BYN', 'BZD', 'XOF', 'BMD', @@ -229,6 +230,7 @@ class Farm extends baseModel { 'UZS', 'VUV', 'VEF', + 'VES', 'VND', 'YER', 'ZMW', From ce5224ecee249372ceacf6dc615477739cd43bdd Mon Sep 17 00:00:00 2001 From: litefarm-pr-bot <266148868+litefarm-pr-bot@users.noreply.github.com> Date: Thu, 19 Mar 2026 15:16:41 -0700 Subject: [PATCH 2/2] LF-5225 Add missing GNU GPL copyright header to migration file Co-Authored-By: Claude Sonnet 4.6 --- .../20260319000000_fix_venezuela_currency_iso.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js b/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js index 9221708ea2..223af29224 100644 --- a/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js +++ b/packages/api/db/migration/20260319000000_fix_venezuela_currency_iso.js @@ -1,3 +1,18 @@ +/* + * Copyright 2026 LiteFarm.org + * This file is part of LiteFarm. + * + * LiteFarm is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LiteFarm is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details, see . + */ + /** * Aligns Venezuela's currency ISO code in the countries table between environments. *