FINERACT-2181: Installment amount in multiples of should be inherited from loan product to loan level

This commit is contained in:
Jose Alberto Hernandez
2025-06-06 10:54:29 +02:00
committed by Adam Saghy
parent 95a8231b18
commit 39a8d5c63e
16 changed files with 94 additions and 36 deletions
@@ -51,4 +51,5 @@
<include relativeToChangelogFile="true" file="parts/1026_add_interest_recognition_flag.xml"/>
<include relativeToChangelogFile="true" file="parts/1027_add_capitalized_income_transaction_type.xml"/>
<include relativeToChangelogFile="true" file="parts/1028_add_missing_indexes.xml"/>
<include relativeToChangelogFile="true" file="parts/1029_add_installment_amount_in_multiples_of_to_loan.xml"/>
</databaseChangeLog>
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<changeSet author="fineract" id="1029-1">
<addColumn tableName="m_loan">
<column defaultValueComputed="NULL" name="installment_amount_in_multiples_of" type="DECIMAL(19, 6)"/>
</addColumn>
</changeSet>
<changeSet author="fineract" id="1029-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<renameColumn tableName="m_product_loan" oldColumnName="instalment_amount_in_multiples_of" newColumnName="installment_amount_in_multiples_of" columnDataType="DECIMAL(19, 6)"/>
</changeSet>
<changeSet author="fineract" id="1029-3-postgresql" context="postgresql">
<sql>
UPDATE m_loan SET installment_amount_in_multiples_of = lp.installment_amount_in_multiples_of FROM (
SELECT id, installment_amount_in_multiples_of FROM m_product_loan
) lp WHERE lp.id = m_loan.product_id
</sql>
</changeSet>
<changeSet author="fineract" id="1029-3-mysql" context="mysql">
<sql>
UPDATE m_loan l inner join m_product_loan lp on lp.id = l.product_id set l.installment_amount_in_multiples_of = lp.installment_amount_in_multiples_of
</sql>
</changeSet>
</databaseChangeLog>