Skip to content

Commit ef25373

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

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-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
@@ -228,4 +228,5 @@
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" />
230230
<include file="parts/0209_transaction_summary_with_asset_owner_and_from_asset_owner_id_for_asset_sales.xml" relativeToChangelogFile="true" />
231+
<include file="parts/0210_postgresql_client_trends_reports.xml" relativeToChangelogFile="true" />
231232
</databaseChangeLog>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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" dbms="postgresql">
28+
<preConditions onFail="MARK_RAN">
29+
<dbms type="postgresql"/>
30+
</preConditions>
31+
<update tableName="stretchy_report">
32+
<column name="report_sql" value="SELECT COUNT(cl.id) AS count, EXTRACT(WEEK FROM cl.activation_date) AS Weeks
33+
FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id
34+
WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' )
35+
AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 weeks') AND CURRENT_DATE)
36+
GROUP BY Weeks"/>
37+
<where>report_name = 'ClientTrendsByWeek'</where>
38+
</update>
39+
</changeSet>
40+
41+
<!-- ClientTrendsByMonth -->
42+
<changeSet author="fineract" id="postgresql-client-trends-month" dbms="postgresql">
43+
<preConditions onFail="MARK_RAN">
44+
<dbms type="postgresql"/>
45+
</preConditions>
46+
<update tableName="stretchy_report">
47+
<column name="report_sql" value="SELECT COUNT(cl.id) AS count, TO_CHAR(cl.activation_date, 'Month') AS Months
48+
FROM m_office o LEFT JOIN m_client cl on o.id = cl.office_id
49+
WHERE o.hierarchy like concat((select ino.hierarchy from m_office ino where ino.id = ${officeId}),'%' )
50+
AND (cl.activation_date BETWEEN (CURRENT_DATE - INTERVAL '12 months') AND CURRENT_DATE)
51+
GROUP BY Months"/>
52+
<where>report_name = 'ClientTrendsByMonth'</where>
53+
</update>
54+
</changeSet>
55+
56+
</databaseChangeLog>

0 commit comments

Comments
 (0)