Skip to content

Commit 9f6a434

Browse files
committed
FINERACT-2436: Fix PostgreSQL compatibility for Client Weekly and Monthly Trends Reports
1 parent ef12056 commit 9f6a434

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,5 @@
227227
<include file="parts/0206_transaction_summary_with_asset_owner_classification_name_bug_fix.xml" relativeToChangelogFile="true" />
228228
<include file="parts/0207_add_allow_full_term_for_tranche.xml" relativeToChangelogFile="true" />
229229
<include file="parts/0208_trial_balance_summary_with_asset_owner_journal_entry_aggregation_fix.xml" relativeToChangelogFile="true" />
230+
<include file="parts/0209_postgresql_client_trends_reports.xml" relativeToChangelogFile="true" />
230231
</databaseChangeLog>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
25+
26+
<!-- ClientTrendsByWeek -->
27+
<changeSet author="fineract" id="postgresql-client-trends-week" context="postgresql">
28+
<update tableName="stretchy_report">
29+
<column name="report_sql" value="SELECT COUNT(cl.id) AS count, EXTRACT(WEEK FROM cl.activation_date) AS Weeks
30+
FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id
31+
WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' )
32+
AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 weeks') AND CURRENT_DATE)
33+
GROUP BY Weeks"/>
34+
<where>report_name = 'ClientTrendsByWeek'</where>
35+
</update>
36+
</changeSet>
37+
38+
<!-- ClientTrendsByMonth -->
39+
<changeSet author="fineract" id="postgresql-client-trends-month" context="postgresql">
40+
<update tableName="stretchy_report">
41+
<column name="report_sql" value="SELECT COUNT(cl.id) AS count, TO_CHAR(cl.activation_date, 'Month') AS Months
42+
FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id
43+
WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' )
44+
AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 months') AND CURRENT_DATE)
45+
GROUP BY Months"/>
46+
<where>report_name = 'ClientTrendsByMonth'</where>
47+
</update>
48+
</changeSet>
49+
50+
</databaseChangeLog>

0 commit comments

Comments
 (0)