Commit cb0cb05a authored by Frank Bergmann's avatar Frank Bergmann

- Added upgrade to exchange rates

parent c4fb9ce1
......@@ -117,7 +117,7 @@ BEGIN
RAISE NOTICE 'im_exchange_rate_fill_holes: cur=%', p_currency;
v_max := 365 * 7;
v_start_date := to_date('2013-01-01', 'YYYY-MM-DD');
v_start_date := to_date('2018-01-01', 'YYYY-MM-DD');
v_end_date = v_start_date + v_max;
RETURN im_exchange_rate_fill_holes (p_currency, v_start_date, v_end_date);
......
-- upgrade-5.0.3.0.0-5.0.3.0.1.sql
SELECT acs_log__debug('/packages/intranet-exchange-rate/sql/postgresql/upgrade/upgrade-5.0.3.0.0-5.0.3.0.1.sql','');
-- Compatibility version of fill_holes:
-- Fills holes for 2013 - 2020.
create or replace function im_exchange_rate_fill_holes (varchar)
returns integer as $body$
DECLARE
p_currency alias for $1;
v_max integer;
v_start_date date;
v_end_date date;
BEGIN
RAISE NOTICE 'im_exchange_rate_fill_holes: cur=%', p_currency;
v_max := 365 * 7;
v_start_date := to_date('2018-01-01', 'YYYY-MM-DD');
v_end_date = v_start_date + v_max;
RETURN im_exchange_rate_fill_holes (p_currency, v_start_date, v_end_date);
end;$body$ language 'plpgsql';
-- Most generic variant of fill_holes:
-- Fill for all currencies in the last 5 years
create or replace function im_exchange_rate_fill_holes ()
returns integer as $body$
DECLARE
row RECORD;
BEGIN
FOR row IN
select iso
from currency_codes
where supported_p = 't'
LOOP
perform im_exchange_rate_fill_holes(row.iso);
END LOOP;
return 0;
end;$body$ language 'plpgsql';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment