Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-exchange-rate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-exchange-rate
Commits
cb0cb05a
Commit
cb0cb05a
authored
Mar 19, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added upgrade to exchange rates
parent
c4fb9ce1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletion
+46
-1
intranet-exchange-rate-create.sql
sql/postgresql/intranet-exchange-rate-create.sql
+1
-1
upgrade-5.0.3.0.0-5.0.3.0.1.sql
sql/postgresql/upgrade/upgrade-5.0.3.0.0-5.0.3.0.1.sql
+45
-0
No files found.
sql/postgresql/intranet-exchange-rate-create.sql
View file @
cb0cb05a
...
...
@@ -117,7 +117,7 @@ BEGIN
RAISE
NOTICE
'im_exchange_rate_fill_holes: cur=%'
,
p_currency
;
v_max
:
=
365
*
7
;
v_start_date
:
=
to_date
(
'201
3
-01-01'
,
'YYYY-MM-DD'
);
v_start_date
:
=
to_date
(
'201
8
-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
);
...
...
sql/postgresql/upgrade/upgrade-5.0.3.0.0-5.0.3.0.1.sql
0 → 100644
View file @
cb0cb05a
-- 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'
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment