Skip to content

Commit 39833bf

Browse files
committed
FINERACT-1858: Backport Flyway migrations to Liquibase for version 1.4 to 1.6 for releases 1.7.x
1 parent 931946e commit 39833bf

4 files changed

Lines changed: 681 additions & 0 deletions

File tree

fineract-provider/build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,26 @@ jib {
304304
}
305305
}
306306

307+
task migrateDatabase {
308+
doFirst {
309+
println "Executing liquibase database migration to version $dbVersion"
310+
311+
def dbUrl = "jdbc:$dbType://$dbHost$dbPort/$dbName"
312+
def changeLogFilePath = "fineract-provider/src/main/resources/db/changelog/tenant/upgrades/0000_upgrade_to_$dbVersion.xml"
313+
314+
liquibase {
315+
activities {
316+
main {
317+
changeLogFile changeLogFilePath
318+
url dbUrl
319+
username project.ext.mysqlUser
320+
password project.ext.mysqlPassword
321+
}
322+
}
323+
}
324+
}
325+
}
326+
307327
tasks.jibDockerBuild.dependsOn(bootJar)
308328

309329
// Configuration for git properties gradle plugin
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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.1.xsd">
25+
<!-- V5__add_schema_connection_parameters.sql -->
26+
<changeSet author="fineract" id="5">
27+
<addColumn tableName="tenant_server_connections">
28+
<column name="schema_connection_parameters" type="TEXT" defaultValueComputed="NULL"/>
29+
</addColumn>
30+
</changeSet>
31+
<!-- V6__add_unique_tenant_identifier.sql -->
32+
<changeSet author="fineract" id="6">
33+
<addUniqueConstraint tableName="tenants" columnNames="identifier" />
34+
</changeSet>
35+
</databaseChangeLog>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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.1.xsd">
25+
<!-- V362__reschedule_interest_to_lrs.sql -->
26+
<changeSet author="fineract" id="362">
27+
<addColumn tableName="m_loan_repayment_schedule">
28+
<column name="reschedule_interest_portion" type="decimal(19,6)" defaultValueComputed="NULL" position="14" />
29+
</addColumn>
30+
</changeSet>
31+
<!-- V363__mnote_indexing_for_performance.sql -->
32+
<changeSet author="fineract" id="363">
33+
<createIndex indexName="savings_account_transaction_id" tableName="m_note">
34+
<column defaultValueComputed="NULL" name="savings_account_transaction_id"/>
35+
</createIndex>
36+
</changeSet>
37+
<!-- V364__elastic_hook_template.sql -->
38+
<changeSet author="fineract" id="364">
39+
<insert tableName="m_hook_templates">
40+
<column name="id" valueNumeric="3"/>
41+
<column name="name" value="Elastic Search"/>
42+
</insert>
43+
<insert tableName="m_hook_schema">
44+
<column name="id" valueNumeric="8"/>
45+
<column name="hook_template_id" valueNumeric="3"/>
46+
<column name="field_type" value="string"/>
47+
<column name="field_name" value="Payload URL"/>
48+
<column name="placeholder" value="http://&lt;host&gt;/&lt;index name&gt;/&lt;type name&gt;"/>
49+
<column name="optional" valueBoolean="false"/>
50+
</insert>
51+
<insert tableName="m_hook_schema">
52+
<column name="id" valueNumeric="9"/>
53+
<column name="hook_template_id" valueNumeric="3"/>
54+
<column name="field_type" value="string"/>
55+
<column name="field_name" value="Content Type"/>
56+
<column name="placeholder" value="json"/>
57+
<column name="optional" valueBoolean="false"/>
58+
</insert>
59+
<insert tableName="m_hook_schema">
60+
<column name="id" valueNumeric="10"/>
61+
<column name="hook_template_id" valueNumeric="3"/>
62+
<column name="field_type" value="string"/>
63+
<column name="field_name" value="Index Name"/>
64+
<column name="placeholder"/>
65+
<column name="optional" valueBoolean="true"/>
66+
</insert>
67+
</changeSet>
68+
<!-- V365__reportCategoryList-FINERACT-1306.sql -->
69+
<changeSet author="fineract" id="365">
70+
<insert tableName="stretchy_parameter">
71+
<column name="id" valueNumeric="1003"/>
72+
<column name="parameter_name" value="reportCategoryList"/>
73+
<column name="parameter_variable"/>
74+
<column name="parameter_label" value="n/a"/>
75+
<column name="parameter_displayType" value="n/a"/>
76+
<column name="parameter_FormatType" value="n/a"/>
77+
<column name="parameter_default" value="n/a"/>
78+
<column name="special" value="Y"/>
79+
<column name="selectOne"/>
80+
<column name="selectAll"/>
81+
<column name="parameter_sql"
82+
value="select r.id as report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,&#10; rp.id as parameter_id, rp.report_parameter_name, p.parameter_name&#10; from stretchy_report r&#10; left join stretchy_report_parameter rp on rp.report_id = r.id&#10; left join stretchy_parameter p on p.id = rp.parameter_id&#10; where r.report_category = '${reportCategory}'&#10; and r.use_report is true and r.self_service_user_report = '${isSelfServiceUser}' &#10; and exists&#10; (select 'f'&#10; from m_appuser_role ur &#10; join m_role r on r.id = ur.role_id&#10; join m_role_permission rp on rp.role_id = r.id&#10; join m_permission p on p.id = rp.permission_id&#10; where ur.appuser_id = ${currentUserId}&#10; and (p.code in ('ALL_FUNCTIONS_READ', 'ALL_FUNCTIONS') or p.code = concat(&quot;READ_&quot;, r.report_name)) )&#10; order by r.report_category, r.report_name, rp.id"/>
83+
<column name="parent_id"/>
84+
</insert>
85+
<insert tableName="stretchy_parameter">
86+
<column name="id" valueNumeric="1004"/>
87+
<column name="parameter_name" value="selectAccount"/>
88+
<column name="parameter_variable" value="accountNo"/>
89+
<column name="parameter_label" value="Enter Account No"/>
90+
<column name="parameter_displayType" value="text"/>
91+
<column name="parameter_FormatType" value="string"/>
92+
<column name="parameter_default" value="n/a"/>
93+
<column name="special"/>
94+
<column name="selectOne"/>
95+
<column name="selectAll"/>
96+
<column name="parameter_sql"/>
97+
<column name="parent_id"/>
98+
</insert>
99+
</changeSet>
100+
</databaseChangeLog>

0 commit comments

Comments
 (0)