Skip to content

Commit 7bff1d8

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 7bff1d8

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-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: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
<!-- Step 1: Delete child records from m_role_permission first -->
23+
<changeSet author="fineract" id="1">
24+
<preConditions onFail="MARK_RAN">
25+
<sqlCheck expectedResult="1">
26+
SELECT COUNT(*) > 0
27+
FROM m_role_permission rp
28+
JOIN m_permission p ON p.id = rp.permission_id
29+
WHERE p.code LIKE '%Pentaho%'
30+
</sqlCheck>
31+
</preConditions>
32+
<comment>Remove role permissions referencing deprecated Pentaho report permissions</comment>
33+
<delete tableName="m_role_permission">
34+
<where>permission_id IN (SELECT id FROM m_permission WHERE code LIKE '%Pentaho%')</where>
35+
</delete>
36+
</changeSet>
37+
38+
<!-- Step 2: Delete parent records from m_permission -->
39+
<changeSet author="fineract" id="2">
40+
<preConditions onFail="MARK_RAN">
41+
<sqlCheck expectedResult="1">SELECT COUNT(*) > 0 FROM m_permission WHERE code LIKE '%Pentaho%'</sqlCheck>
42+
</preConditions>
43+
<comment>Remove deprecated Pentaho report permissions</comment>
44+
<delete tableName="m_permission">
45+
<where>code LIKE '%Pentaho%'</where>
46+
</delete>
47+
</changeSet>
48+
49+
<!-- Step 3: Delete Pentaho reports from stretchy_report -->
50+
<changeSet author="fineract" id="3">
51+
<preConditions onFail="MARK_RAN">
52+
<sqlCheck expectedResult="1">SELECT COUNT(*) > 0 FROM stretchy_report WHERE report_name LIKE '%Pentaho%'</sqlCheck>
53+
</preConditions>
54+
<comment>Remove deprecated Pentaho reports from stretchy_report table</comment>
55+
<delete tableName="stretchy_report">
56+
<where>report_name LIKE '%Pentaho%'</where>
57+
</delete>
58+
</changeSet>
59+
</databaseChangeLog>

0 commit comments

Comments
 (0)