FINERACT-2232: Create LoanCapitalizedIncomeBalance entity and table

This commit is contained in:
adam.magyari
2025-04-22 12:34:01 +02:00
committed by Adam Saghy
parent cbfd370844
commit 269c2b1f28
4 changed files with 213 additions and 0 deletions
@@ -190,4 +190,5 @@
<include file="parts/0169_add_missing_permissions.xml" relativeToChangelogFile="true" />
<include file="parts/0170_days_in_year_custom_strategy.xml" relativeToChangelogFile="true"/>
<include file="parts/0171_loan_capitalized_income.xml" relativeToChangelogFile="true"/>
<include file="parts/0172_create_loan_capitalized_income_balance.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,117 @@
<?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="1" context="postgresql">
<createTable tableName="m_loan_capitalized_income_balance">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_m_loan_capitalized_income_balance"/>
</column>
<column name="version" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="loan_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="loan_transaction_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="amount" type="DECIMAL(19, 6)">
<constraints nullable="false"/>
</column>
<column name="date" type="DATE">
<constraints nullable="false"/>
</column>
<column name="unrecognized_amount" type="DECIMAL(19, 6)">
<constraints nullable="false"/>
</column>
<column name="charged_off_amount" type="DECIMAL(19, 6)" />
<column name="amount_adjustment" type="DECIMAL(19, 6)" />
<column name="created_by" type="BIGINT"/>
<column name="created_on_utc" type="timestamp with time zone"/>
<column name="last_modified_by" type="BIGINT"/>
<column name="last_modified_on_utc" type="timestamp with time zone"/>
</createTable>
</changeSet>
<changeSet author="fineract" id="2" context="mysql">
<createTable tableName="m_loan_capitalized_income_balance">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_m_loan_capitalized_income_balance"/>
</column>
<column name="version" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="loan_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="loan_transaction_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="amount" type="DECIMAL(19, 6)">
<constraints nullable="false"/>
</column>
<column name="date" type="DATE">
<constraints nullable="false"/>
</column>
<column name="unrecognized_amount" type="DECIMAL(19, 6)">
<constraints nullable="false"/>
</column>
<column name="charged_off_amount" type="DECIMAL(19, 6)" />
<column name="amount_adjustment" type="DECIMAL(19, 6)" />
<column name="created_by" type="BIGINT"/>
<column name="created_on_utc" type="DATETIME"/>
<column name="last_modified_by" type="BIGINT"/>
<column name="last_modified_on_utc" type="DATETIME"/>
</createTable>
</changeSet>
<changeSet author="fineract" id="3">
<addForeignKeyConstraint baseColumnNames="created_by" baseTableName="m_loan_capitalized_income_balance"
constraintName="FK_loan_capitalized_income_balance_created_by" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="last_modified_by" baseTableName="m_loan_capitalized_income_balance"
constraintName="FK_loan_capitalized_income_balance_last_modified_by" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_appuser" validate="true"/>
<addForeignKeyConstraint baseColumnNames="loan_id" baseTableName="m_loan_capitalized_income_balance"
constraintName="FK_loan_capitalized_income_balance_loan_id" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_loan" validate="true"/>
<addForeignKeyConstraint baseColumnNames="loan_transaction_id" baseTableName="m_loan_capitalized_income_balance"
constraintName="FK_loan_capitalized_income_balance_transaction_id" deferrable="false" initiallyDeferred="false"
onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="id"
referencedTableName="m_loan_transaction" validate="true"/>
</changeSet>
<changeSet author="fineract" id="4" runInTransaction="false" context="postgresql">
<sql>
create unique index concurrently if not exists m_loan_capitalized_income_balance_idx_1 on m_loan_capitalized_income_balance(loan_id,loan_transaction_id);
create index concurrently if not exists m_loan_capitalized_income_balance_idx_2 on m_loan_capitalized_income_balance(loan_id);
</sql>
</changeSet>
<changeSet author="fineract" id="5" context="mysql">
<sql>
create unique index m_loan_capitalized_income_balance_idx_1 on m_loan_capitalized_income_balance(loan_id,loan_transaction_id);
create index m_loan_capitalized_income_balance_idx_2 on m_loan_capitalized_income_balance(loan_id);
</sql>
</changeSet>
</databaseChangeLog>