Skip to content

Commit d4108f6

Browse files
FINERACT-2481: Remove Pentaho reports from initial sample data
Remove deprecated Pentaho report entries from initial data using Liquibase migration. Changes: - Added migration 0210_remove_pentaho_reports.xml with explicit report names - Deletes 26 Pentaho permission entries from m_permission table - Deletes 44 Pentaho report entries from stretchy_report table - Handles child table (stretchy_report_parameter) before parent deletion - Uses case-insensitive matching for cross-database compatibility The migration includes preConditions to safely handle cases where Pentaho data has already been removed, ensuring idempotent execution.
1 parent 6269cbb commit d4108f6

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-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_remove_pentaho_reports.xml" relativeToChangelogFile="true" />
231232
</databaseChangeLog>
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
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
25+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
26+
<changeSet author="fineract" id="1">
27+
<preConditions onFail="MARK_RAN">
28+
<sqlCheck expectedResult="1">
29+
SELECT COUNT(*) > 0
30+
FROM m_role_permission rp
31+
JOIN m_permission p ON p.id = rp.permission_id
32+
WHERE LOWER(p.code) LIKE LOWER('%Pentaho%')
33+
</sqlCheck>
34+
</preConditions>
35+
<comment>Remove role permissions for deprecated Pentaho reports</comment>
36+
<sql>
37+
DELETE FROM m_role_permission
38+
WHERE permission_id IN (SELECT id FROM m_permission WHERE LOWER(code) LIKE LOWER('%Pentaho%'));
39+
</sql>
40+
</changeSet>
41+
<changeSet author="fineract" id="2">
42+
<preConditions onFail="MARK_RAN">
43+
<sqlCheck expectedResult="1">
44+
SELECT COUNT(*) > 0 FROM m_permission WHERE LOWER(code) LIKE LOWER('%Pentaho%')
45+
</sqlCheck>
46+
</preConditions>
47+
<comment>Remove deprecated Pentaho report permissions</comment>
48+
<sql>
49+
DELETE FROM m_permission WHERE code IN (
50+
'READ_Active Loans - Summary(Pentaho)',
51+
'READ_Active Loans by Disbursal Period(Pentaho)',
52+
'READ_Active Loans in last installment Summary(Pentaho)',
53+
'READ_Active Loans in last installment(Pentaho)',
54+
'READ_Active Loans Passed Final Maturity Summary(Pentaho)',
55+
'READ_Active Loans Passed Final Maturity(Pentaho)',
56+
'READ_Aging Detail(Pentaho)',
57+
'READ_Aging Summary (Arrears in Months)(Pentaho)',
58+
'READ_Aging Summary (Arrears in Weeks)(Pentaho)',
59+
'READ_Client Listing(Pentaho)',
60+
'READ_Client Loans Listing(Pentaho)',
61+
'READ_Expected Payments By Date - Basic(Pentaho)',
62+
'READ_Funds Disbursed Between Dates Summary by Office(Pentaho)',
63+
'READ_Funds Disbursed Between Dates Summary(Pentaho)',
64+
'READ_Loans Awaiting Disbursal Summary by Month(Pentaho)',
65+
'READ_Loans Awaiting Disbursal Summary(Pentaho)',
66+
'READ_Loans Awaiting Disbursal(Pentaho)',
67+
'READ_Loans Pending Approval(Pentaho)',
68+
'READ_Obligation Met Loans Details(Pentaho)',
69+
'READ_Obligation Met Loans Summary(Pentaho)',
70+
'READ_Portfolio at Risk by Branch(Pentaho)',
71+
'READ_Portfolio at Risk(Pentaho)',
72+
'READ_Rescheduled Loans(Pentaho)',
73+
'READ_TxnRunningBalances(Pentaho)',
74+
'READ_Written-Off Loans(Pentaho)',
75+
'READ_Staff Assignment History'
76+
);
77+
</sql>
78+
</changeSet>
79+
<changeSet author="fineract" id="3">
80+
<preConditions onFail="MARK_RAN">
81+
<sqlCheck expectedResult="1">
82+
SELECT COUNT(*) > 0
83+
FROM stretchy_report_parameter
84+
WHERE report_id IN (SELECT id FROM stretchy_report WHERE LOWER(report_type) = LOWER('Pentaho'))
85+
</sqlCheck>
86+
</preConditions>
87+
<comment>Remove parameters for deprecated Pentaho reports</comment>
88+
<sql>
89+
DELETE FROM stretchy_report_parameter
90+
WHERE report_id IN (SELECT id FROM stretchy_report WHERE LOWER(report_type) = LOWER('Pentaho'));
91+
</sql>
92+
</changeSet>
93+
<changeSet author="fineract" id="4">
94+
<preConditions onFail="MARK_RAN">
95+
<sqlCheck expectedResult="1">
96+
SELECT COUNT(*) > 0 FROM stretchy_report WHERE LOWER(report_type) = LOWER('Pentaho')
97+
</sqlCheck>
98+
</preConditions>
99+
<comment>Remove deprecated Pentaho reports from stretchy_report</comment>
100+
<sql>
101+
DELETE FROM stretchy_report WHERE report_name IN (
102+
'Balance Sheet',
103+
'Income Statement',
104+
'Trial Balance',
105+
'Loan Account Schedule',
106+
'Branch Expected Cash Flow',
107+
'Expected Payments By Date - Formatted',
108+
'Savings Transactions',
109+
'Client Savings Summary',
110+
'Active Loans - Details(Pentaho)',
111+
'Active Loans - Summary(Pentaho)',
112+
'Active Loans by Disbursal Period(Pentaho)',
113+
'Active Loans in last installment Summary(Pentaho)',
114+
'Active Loans in last installment(Pentaho)',
115+
'Active Loans Passed Final Maturity Summary(Pentaho)',
116+
'Active Loans Passed Final Maturity(Pentaho)',
117+
'Aging Detail(Pentaho)',
118+
'Aging Summary (Arrears in Months)(Pentaho)',
119+
'Aging Summary (Arrears in Weeks)(Pentaho)',
120+
'Client Listing(Pentaho)',
121+
'Client Loans Listing(Pentaho)',
122+
'Expected Payments By Date - Basic(Pentaho)',
123+
'Funds Disbursed Between Dates Summary by Office(Pentaho)',
124+
'Funds Disbursed Between Dates Summary(Pentaho)',
125+
'Loans Awaiting Disbursal Summary by Month(Pentaho)',
126+
'Loans Awaiting Disbursal Summary(Pentaho)',
127+
'Loans Awaiting Disbursal(Pentaho)',
128+
'Loans Pending Approval(Pentaho)',
129+
'Obligation Met Loans Details(Pentaho)',
130+
'Obligation Met Loans Summary(Pentaho)',
131+
'Portfolio at Risk by Branch(Pentaho)',
132+
'Portfolio at Risk(Pentaho)',
133+
'Rescheduled Loans(Pentaho)',
134+
'TxnRunningBalances(Pentaho)',
135+
'Written-Off Loans(Pentaho)',
136+
'Client Saving Transactions',
137+
'Client Loan Account Schedule',
138+
'Savings Transaction Receipt',
139+
'Loan Transaction Receipt',
140+
'Staff Assignment History',
141+
'GeneralLedgerReport',
142+
'Active Loan Summary per Branch',
143+
'Balance Outstanding',
144+
'Collection Report',
145+
'Disbursal Report'
146+
) AND LOWER(report_type) = LOWER('Pentaho');
147+
</sql>
148+
</changeSet>
149+
</databaseChangeLog>

0 commit comments

Comments
 (0)