Merge remote-tracking branch 'self-hosted/feature/account-charges' into feature/Backend-DSC-MFA

# Conflicts:
#	fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
This commit is contained in:
Aditya
2026-05-20 13:26:58 +05:30
112 changed files with 207214 additions and 46034 deletions
@@ -407,7 +407,7 @@ server.tomcat.mbeanregistry.enabled=${FINERACT_SERVER_TOMCAT_MBEANREGISTRY_ENABL
spring.datasource.hikari.driverClassName=${FINERACT_HIKARI_DRIVER_SOURCE_CLASS_NAME:org.postgresql.Driver}
spring.datasource.hikari.jdbcUrl=${FINERACT_HIKARI_JDBC_URL:jdbc:postgresql://localhost:5432/fineract_tenants}
spring.datasource.hikari.username=${FINERACT_HIKARI_USERNAME:postgres}
spring.datasource.hikari.password=${FINERACT_HIKARI_PASSWORD:root}
spring.datasource.hikari.password=${FINERACT_HIKARI_PASSWORD:313863}
spring.datasource.hikari.minimumIdle=${FINERACT_HIKARI_MINIMUM_IDLE:3}
spring.datasource.hikari.maximumPoolSize=${FINERACT_HIKARI_MAXIMUM_POOL_SIZE:10}
spring.datasource.hikari.idleTimeout=${FINERACT_HIKARI_IDLE_TIMEOUT:60000}
@@ -289,6 +289,11 @@
<include file="parts/0273_add_gl_account_id_to_current_product.xml" relativeToChangelogFile="true"/>
<include file="parts/0276_create_current_account_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0277_fix_current_account_audit_columns.xml" relativeToChangelogFile="true"/>
<include file="parts/0278_add_is_mandatory_to_joint_holder.xml" relativeToChangelogFile="true"/>
<include file="parts/0279_add_fd_type_and_base_interest_rate_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0280_add_fixed_deposit_product_codes.xml" relativeToChangelogFile="true"/>
<include file="parts/0284_remove_product_code_unique_constraints.xml" relativeToChangelogFile="true"/>
<include file="parts/0281_update_fd_base_interest_rate_seed_data.xml" relativeToChangelogFile="true"/>
<include file="parts/0278_add_soft_delete_to_family_members.xml" relativeToChangelogFile="true"/>
<include file="parts/0279_add_soft_delete_columns_client_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0280_add_deletion_audit_and_version_columns.xml" relativeToChangelogFile="true"/>
@@ -308,5 +313,7 @@
<include file="parts/0294_add_tfa_token_to_dsc_challenge.xml" relativeToChangelogFile="true"/>
<include file="parts/0295_unique_email_mobile_on_m_appuser.xml" relativeToChangelogFile="true"/>
<include file="parts/0296_unique_nominee_per_account_type.xml" relativeToChangelogFile="true"/>
<include file="parts/0297_seed_indian_states.xml" relativeToChangelogFile="true"/>
<include file="parts/0297_fix_unique_nominee_per_account.xml" relativeToChangelogFile="true"/>
<include file="parts/0298_unique_external_id_on_current_account.xml" relativeToChangelogFile="true"/>
<include file="parts/0299_seed_indian_states.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 id="0278_add_is_mandatory_to_joint_holder" author="system">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_current_account_joint_holder" columnName="is_mandatory"/>
</not>
</preConditions>
<addColumn tableName="m_current_account_joint_holder">
<column name="is_mandatory" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<changeSet id="0278b_add_is_mandatory_to_savings_joint_holder" author="system">
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_savings_account_joint_holders"/>
<not>
<columnExists tableName="m_savings_account_joint_holders" columnName="is_mandatory"/>
</not>
</and>
</preConditions>
<addColumn tableName="m_savings_account_joint_holders">
<column name="is_mandatory" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,300 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd">
<!-- 1. Add fd_type column to m_savings_product -->
<changeSet id="0279a_add_fd_type_to_savings_product" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_savings_product" columnName="fd_type"/></not>
</preConditions>
<addColumn tableName="m_savings_product">
<column name="fd_type" type="VARCHAR(20)" defaultValue="SINGLE">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
<!-- 2. Create FD base interest rate effective (version) table -->
<changeSet id="0279b_create_fd_base_interest_rate_effective" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="m_fd_base_interest_rate_effective"/></not>
</preConditions>
<createTable tableName="m_fd_base_interest_rate_effective">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="fd_type" type="VARCHAR(20)">
<constraints nullable="false"/>
</column>
<column name="version_label" type="VARCHAR(100)">
<constraints nullable="false"/>
</column>
<column name="effective_from_date" type="DATE">
<constraints nullable="false"/>
</column>
<column name="effective_to_date" type="DATE"/>
<column name="is_active" type="BOOLEAN" defaultValueBoolean="true">
<constraints nullable="false"/>
</column>
<column name="remarks" type="VARCHAR(500)"/>
<column name="created_by_id" type="BIGINT"/>
<column name="created_date" type="DATE"/>
</createTable>
</changeSet>
<!-- 3. Create FD base interest rate slab history table -->
<changeSet id="0279c_create_fd_base_interest_rate_slab_history" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<not><tableExists tableName="m_fd_base_interest_rate_slab_history"/></not>
</preConditions>
<createTable tableName="m_fd_base_interest_rate_slab_history">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="effective_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="sr_no" type="INT">
<constraints nullable="false"/>
</column>
<column name="description" type="VARCHAR(200)"/>
<!-- period_type_enum: 0=DAYS, 1=WEEKS, 2=MONTHS, 3=YEARS -->
<column name="period_type_enum" type="INT" defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="from_period" type="INT">
<constraints nullable="false"/>
</column>
<column name="to_period" type="INT"/>
<column name="annual_interest_rate" type="DECIMAL(19,6)">
<constraints nullable="false"/>
</column>
<!-- senior_citizen_rate: additional rate for senior citizens -->
<column name="senior_citizen_rate" type="DECIMAL(19,6)" defaultValueNumeric="0"/>
<column name="created_date" type="DATE"/>
</createTable>
<addForeignKeyConstraint
baseTableName="m_fd_base_interest_rate_slab_history"
baseColumnNames="effective_id"
referencedTableName="m_fd_base_interest_rate_effective"
referencedColumnNames="id"
constraintName="fk_fd_base_rate_slab_effective"/>
</changeSet>
<!-- 4. Seed initial FD base interest rate data -->
<changeSet id="0279d_seed_fd_base_interest_rate_single" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SINGLE'</sqlCheck>
</preConditions>
<!-- FD SINGLE: &lt; 1 year, period in DAYS -->
<insert tableName="m_fd_base_interest_rate_effective">
<column name="fd_type" value="SINGLE"/>
<column name="version_label" value="FD-SINGLE-V1"/>
<column name="effective_from_date" value="2025-01-01"/>
<column name="is_active" valueBoolean="true"/>
<column name="remarks" value="Initial FD Single (Short Term) rates"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
<changeSet id="0279e_seed_fd_single_slabs" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_slab_history sh JOIN m_fd_base_interest_rate_effective e ON sh.effective_id = e.id WHERE e.fd_type = 'SINGLE'</sqlCheck>
</preConditions>
<!-- 1-29 days -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SINGLE' AND version_label='FD-SINGLE-V1')"/>
<column name="sr_no" valueNumeric="1"/>
<column name="description" value="1 to 29 Days"/>
<column name="period_type_enum" valueNumeric="0"/>
<column name="from_period" valueNumeric="1"/>
<column name="to_period" valueNumeric="29"/>
<column name="annual_interest_rate" valueNumeric="4.50"/>
<column name="senior_citizen_rate" valueNumeric="5.00"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 30-89 days -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SINGLE' AND version_label='FD-SINGLE-V1')"/>
<column name="sr_no" valueNumeric="2"/>
<column name="description" value="30 to 89 Days"/>
<column name="period_type_enum" valueNumeric="0"/>
<column name="from_period" valueNumeric="30"/>
<column name="to_period" valueNumeric="89"/>
<column name="annual_interest_rate" valueNumeric="5.00"/>
<column name="senior_citizen_rate" valueNumeric="5.50"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 90-179 days -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SINGLE' AND version_label='FD-SINGLE-V1')"/>
<column name="sr_no" valueNumeric="3"/>
<column name="description" value="90 to 179 Days"/>
<column name="period_type_enum" valueNumeric="0"/>
<column name="from_period" valueNumeric="90"/>
<column name="to_period" valueNumeric="179"/>
<column name="annual_interest_rate" valueNumeric="5.50"/>
<column name="senior_citizen_rate" valueNumeric="6.00"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 180+ days -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SINGLE' AND version_label='FD-SINGLE-V1')"/>
<column name="sr_no" valueNumeric="4"/>
<column name="description" value="180+ Days"/>
<column name="period_type_enum" valueNumeric="0"/>
<column name="from_period" valueNumeric="180"/>
<column name="annual_interest_rate" valueNumeric="6.00"/>
<column name="senior_citizen_rate" valueNumeric="6.50"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
<changeSet id="0279f_seed_fd_base_interest_rate_double" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_effective WHERE fd_type = 'DOUBLE'</sqlCheck>
</preConditions>
<!-- FD DOUBLE: >= 1 year, period in YEARS -->
<insert tableName="m_fd_base_interest_rate_effective">
<column name="fd_type" value="DOUBLE"/>
<column name="version_label" value="FD-DOUBLE-V1"/>
<column name="effective_from_date" value="2025-01-01"/>
<column name="is_active" valueBoolean="true"/>
<column name="remarks" value="Initial FD Double (Long Term) rates"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
<changeSet id="0279g_seed_fd_double_slabs" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_slab_history sh JOIN m_fd_base_interest_rate_effective e ON sh.effective_id = e.id WHERE e.fd_type = 'DOUBLE'</sqlCheck>
</preConditions>
<!-- 1-2 years -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='DOUBLE' AND version_label='FD-DOUBLE-V1')"/>
<column name="sr_no" valueNumeric="1"/>
<column name="description" value="1 to 2 Years"/>
<column name="period_type_enum" valueNumeric="3"/>
<column name="from_period" valueNumeric="1"/>
<column name="to_period" valueNumeric="2"/>
<column name="annual_interest_rate" valueNumeric="6.50"/>
<column name="senior_citizen_rate" valueNumeric="7.00"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 3-5 years -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='DOUBLE' AND version_label='FD-DOUBLE-V1')"/>
<column name="sr_no" valueNumeric="2"/>
<column name="description" value="3 to 5 Years"/>
<column name="period_type_enum" valueNumeric="3"/>
<column name="from_period" valueNumeric="3"/>
<column name="to_period" valueNumeric="5"/>
<column name="annual_interest_rate" valueNumeric="6.75"/>
<column name="senior_citizen_rate" valueNumeric="7.25"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 6-10 years -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='DOUBLE' AND version_label='FD-DOUBLE-V1')"/>
<column name="sr_no" valueNumeric="3"/>
<column name="description" value="6 to 10 Years"/>
<column name="period_type_enum" valueNumeric="3"/>
<column name="from_period" valueNumeric="6"/>
<column name="to_period" valueNumeric="10"/>
<column name="annual_interest_rate" valueNumeric="7.00"/>
<column name="senior_citizen_rate" valueNumeric="7.50"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 11+ years -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='DOUBLE' AND version_label='FD-DOUBLE-V1')"/>
<column name="sr_no" valueNumeric="4"/>
<column name="description" value="11+ Years"/>
<column name="period_type_enum" valueNumeric="3"/>
<column name="from_period" valueNumeric="11"/>
<column name="annual_interest_rate" valueNumeric="7.25"/>
<column name="senior_citizen_rate" valueNumeric="7.75"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
<changeSet id="0279h_seed_fd_base_interest_rate_special" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SPECIAL'</sqlCheck>
</preConditions>
<!-- FD SPECIAL: monthly interest payout, period in MONTHS -->
<insert tableName="m_fd_base_interest_rate_effective">
<column name="fd_type" value="SPECIAL"/>
<column name="version_label" value="FD-SPECIAL-V1"/>
<column name="effective_from_date" value="2025-01-01"/>
<column name="is_active" valueBoolean="true"/>
<column name="remarks" value="Initial FD Special (Monthly Payout) rates"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
<changeSet id="0279i_seed_fd_special_slabs" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_fd_base_interest_rate_slab_history sh JOIN m_fd_base_interest_rate_effective e ON sh.effective_id = e.id WHERE e.fd_type = 'SPECIAL'</sqlCheck>
</preConditions>
<!-- 1-12 months -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SPECIAL' AND version_label='FD-SPECIAL-V1')"/>
<column name="sr_no" valueNumeric="1"/>
<column name="description" value="1 to 12 Months"/>
<column name="period_type_enum" valueNumeric="2"/>
<column name="from_period" valueNumeric="1"/>
<column name="to_period" valueNumeric="12"/>
<column name="annual_interest_rate" valueNumeric="6.00"/>
<column name="senior_citizen_rate" valueNumeric="6.50"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 13-24 months -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SPECIAL' AND version_label='FD-SPECIAL-V1')"/>
<column name="sr_no" valueNumeric="2"/>
<column name="description" value="13 to 24 Months"/>
<column name="period_type_enum" valueNumeric="2"/>
<column name="from_period" valueNumeric="13"/>
<column name="to_period" valueNumeric="24"/>
<column name="annual_interest_rate" valueNumeric="6.50"/>
<column name="senior_citizen_rate" valueNumeric="7.00"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 25-60 months -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SPECIAL' AND version_label='FD-SPECIAL-V1')"/>
<column name="sr_no" valueNumeric="3"/>
<column name="description" value="25 to 60 Months"/>
<column name="period_type_enum" valueNumeric="2"/>
<column name="from_period" valueNumeric="25"/>
<column name="to_period" valueNumeric="60"/>
<column name="annual_interest_rate" valueNumeric="7.00"/>
<column name="senior_citizen_rate" valueNumeric="7.50"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
<!-- 61+ months -->
<insert tableName="m_fd_base_interest_rate_slab_history">
<column name="effective_id" valueComputed="(SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type='SPECIAL' AND version_label='FD-SPECIAL-V1')"/>
<column name="sr_no" valueNumeric="4"/>
<column name="description" value="61+ Months"/>
<column name="period_type_enum" valueNumeric="2"/>
<column name="from_period" valueNumeric="61"/>
<column name="annual_interest_rate" valueNumeric="7.25"/>
<column name="senior_citizen_rate" valueNumeric="7.75"/>
<column name="created_date" valueDate="2025-01-01"/>
</insert>
</changeSet>
</databaseChangeLog>
@@ -34,7 +34,10 @@
<!-- 1. Tables that already have is_active — add is_deleted only -->
<changeSet id="0279a_is_deleted_client_address" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_address" columnName="is_deleted"/></not>
<and>
<tableExists tableName="m_client_address"/>
<not><columnExists tableName="m_client_address" columnName="is_deleted"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_address">
<column name="is_deleted" type="boolean" defaultValueBoolean="false">
@@ -45,7 +48,10 @@
<changeSet id="0279b_is_deleted_client_nominee" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_nominee" columnName="is_deleted"/></not>
<and>
<tableExists tableName="m_client_nominee"/>
<not><columnExists tableName="m_client_nominee" columnName="is_deleted"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_nominee">
<column name="is_deleted" type="boolean" defaultValueBoolean="false">
@@ -56,7 +62,10 @@
<changeSet id="0279c_is_deleted_client_charge" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_charge" columnName="is_deleted"/></not>
<and>
<tableExists tableName="m_client_charge"/>
<not><columnExists tableName="m_client_charge" columnName="is_deleted"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_charge">
<column name="is_deleted" type="boolean" defaultValueBoolean="false">
@@ -68,7 +77,10 @@
<!-- 2. Tables that have neither — add both -->
<changeSet id="0279d_flags_client_non_person" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_non_person" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_non_person"/>
<not><columnExists tableName="m_client_non_person" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_non_person">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -82,7 +94,10 @@
<changeSet id="0279e_flags_client_identifier" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_identifier" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_identifier"/>
<not><columnExists tableName="m_client_identifier" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_identifier">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -96,7 +111,10 @@
<changeSet id="0279f_flags_client_kyc" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_kyc" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_kyc"/>
<not><columnExists tableName="m_client_kyc" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_kyc">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -110,7 +128,10 @@
<changeSet id="0279g_flags_address" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_address" columnName="is_active"/></not>
<and>
<tableExists tableName="m_address"/>
<not><columnExists tableName="m_address" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_address">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -124,7 +145,10 @@
<changeSet id="0279h_flags_client_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_priority_sector" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_priority_sector"/>
<not><columnExists tableName="m_client_priority_sector" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_priority_sector">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -138,7 +162,10 @@
<changeSet id="0279i_flags_client_non_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_non_priority_sector" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_non_priority_sector"/>
<not><columnExists tableName="m_client_non_priority_sector" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_non_priority_sector">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -152,7 +179,10 @@
<changeSet id="0279j_flags_client_msme" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_msme" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_msme"/>
<not><columnExists tableName="m_client_msme" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_msme">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -166,7 +196,10 @@
<changeSet id="0279k_flags_client_mudra_borrower" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_mudra_borrower" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_mudra_borrower"/>
<not><columnExists tableName="m_client_mudra_borrower" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_mudra_borrower">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -180,7 +213,10 @@
<changeSet id="0279l_flags_client_startup_india" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_startup_india" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_startup_india"/>
<not><columnExists tableName="m_client_startup_india" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_startup_india">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -194,7 +230,10 @@
<changeSet id="0279m_flags_client_eou" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_eou" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_eou"/>
<not><columnExists tableName="m_client_eou" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_eou">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -208,7 +247,10 @@
<changeSet id="0279n_flags_client_charge_paid_by" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_charge_paid_by" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_charge_paid_by"/>
<not><columnExists tableName="m_client_charge_paid_by" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_charge_paid_by">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -222,7 +264,10 @@
<changeSet id="0279o_flags_client_collateral_management" author="fineract">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_client_collateral_management" columnName="is_active"/></not>
<and>
<tableExists tableName="m_client_collateral_management"/>
<not><columnExists tableName="m_client_collateral_management" columnName="is_active"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_collateral_management">
<column name="is_active" type="boolean" defaultValueBoolean="true">
@@ -28,7 +28,12 @@
-->
<changeSet id="0280a_deletion_audit_family_members" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_family_members" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_family_members"/>
<not><columnExists tableName="m_family_members" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_family_members">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -37,7 +42,12 @@
</changeSet>
<changeSet id="0280b_deletion_audit_client_address" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_address" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_address"/>
<not><columnExists tableName="m_client_address" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_address">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -46,7 +56,12 @@
</changeSet>
<changeSet id="0280c_deletion_audit_client_nominee" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_nominee" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_nominee"/>
<not><columnExists tableName="m_client_nominee" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_nominee">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -55,7 +70,12 @@
</changeSet>
<changeSet id="0280d_deletion_audit_client_charge" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_charge" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_charge"/>
<not><columnExists tableName="m_client_charge" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_charge">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -64,7 +84,12 @@
</changeSet>
<changeSet id="0280e_deletion_audit_client_non_person" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_non_person" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_non_person"/>
<not><columnExists tableName="m_client_non_person" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_non_person">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -73,7 +98,12 @@
</changeSet>
<changeSet id="0280f_deletion_audit_client_identifier" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_identifier" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_identifier"/>
<not><columnExists tableName="m_client_identifier" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_identifier">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -82,7 +112,12 @@
</changeSet>
<changeSet id="0280g_deletion_audit_client_kyc" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_kyc" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_kyc"/>
<not><columnExists tableName="m_client_kyc" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_kyc">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -91,7 +126,12 @@
</changeSet>
<changeSet id="0280h_deletion_audit_address" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_address" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_address"/>
<not><columnExists tableName="m_address" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_address">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -100,7 +140,12 @@
</changeSet>
<changeSet id="0280i_deletion_audit_client_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_priority_sector" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_priority_sector"/>
<not><columnExists tableName="m_client_priority_sector" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_priority_sector">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -109,7 +154,12 @@
</changeSet>
<changeSet id="0280j_deletion_audit_client_non_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_non_priority_sector" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_non_priority_sector"/>
<not><columnExists tableName="m_client_non_priority_sector" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_non_priority_sector">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -118,7 +168,12 @@
</changeSet>
<changeSet id="0280k_deletion_audit_client_msme" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_msme" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_msme"/>
<not><columnExists tableName="m_client_msme" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_msme">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -127,7 +182,12 @@
</changeSet>
<changeSet id="0280l_deletion_audit_client_mudra_borrower" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_mudra_borrower" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_mudra_borrower"/>
<not><columnExists tableName="m_client_mudra_borrower" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_mudra_borrower">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -136,7 +196,12 @@
</changeSet>
<changeSet id="0280m_deletion_audit_client_startup_india" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_startup_india" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_startup_india"/>
<not><columnExists tableName="m_client_startup_india" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_startup_india">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -145,7 +210,12 @@
</changeSet>
<changeSet id="0280n_deletion_audit_client_eou" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_eou" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_eou"/>
<not><columnExists tableName="m_client_eou" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_eou">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -154,7 +224,12 @@
</changeSet>
<changeSet id="0280o_deletion_audit_client_charge_paid_by" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_charge_paid_by" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_charge_paid_by"/>
<not><columnExists tableName="m_client_charge_paid_by" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_charge_paid_by">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -163,7 +238,12 @@
</changeSet>
<changeSet id="0280p_deletion_audit_client_collateral_management" author="fineract">
<preConditions onFail="MARK_RAN"><not><columnExists tableName="m_client_collateral_management" columnName="deleted_at"/></not></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_collateral_management"/>
<not><columnExists tableName="m_client_collateral_management" columnName="deleted_at"/></not>
</and>
</preConditions>
<addColumn tableName="m_client_collateral_management">
<column name="deleted_by" type="bigint"/>
<column name="deleted_at" type="datetime"/>
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd">
<!-- FixedDepositProductAccountType code and values -->
<changeSet id="0280a_add_fd_product_account_type_code" author="system">
<validCheckSum>ANY</validCheckSum>
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'FixedDepositProductAccountType', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'FixedDepositProductAccountType');
</sql>
<sql>
INSERT INTO m_code_value (code_id, code_value, order_position, is_active, is_mandatory)
SELECT c.id, v.code_value, v.order_position, true, false
FROM m_code c,
(VALUES
('Fd Account', 1)
) AS v(code_value, order_position)
WHERE c.code_name = 'FixedDepositProductAccountType'
AND NOT EXISTS (
SELECT 1 FROM m_code_value cv
WHERE cv.code_id = c.id AND cv.code_value = v.code_value
);
</sql>
</changeSet>
<!-- FixedDepositProductCustomerSegment code and values -->
<changeSet id="0280b_add_fd_product_customer_segment_code" author="system">
<validCheckSum>ANY</validCheckSum>
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'FixedDepositProductCustomerSegment', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'FixedDepositProductCustomerSegment');
</sql>
<sql>
INSERT INTO m_code_value (code_id, code_value, order_position, is_active, is_mandatory)
SELECT c.id, v.code_value, v.order_position, true, false
FROM m_code c,
(VALUES
('Individual', 1),
('Non-Individual', 2)
) AS v(code_value, order_position)
WHERE c.code_name = 'FixedDepositProductCustomerSegment'
AND NOT EXISTS (
SELECT 1 FROM m_code_value cv
WHERE cv.code_id = c.id AND cv.code_value = v.code_value
);
</sql>
</changeSet>
</databaseChangeLog>
@@ -38,63 +38,108 @@
<!-- =========================== Group A: rename =========================== -->
<changeSet id="0281a_rename_audit_client_nominee" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_nominee" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_nominee"/>
<columnExists tableName="m_client_nominee" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_nominee" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_nominee" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_nominee" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281b_rename_audit_client_identifier" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_identifier" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_identifier"/>
<columnExists tableName="m_client_identifier" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_identifier" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_identifier" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_identifier" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281c_rename_audit_client_kyc" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_kyc" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_kyc"/>
<columnExists tableName="m_client_kyc" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_kyc" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_kyc" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_kyc" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281d_rename_audit_client_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_priority_sector" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_priority_sector"/>
<columnExists tableName="m_client_priority_sector" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_priority_sector" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_priority_sector" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_priority_sector" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281e_rename_audit_client_non_priority_sector" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_non_priority_sector" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_non_priority_sector"/>
<columnExists tableName="m_client_non_priority_sector" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_non_priority_sector" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_non_priority_sector" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_non_priority_sector" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281f_rename_audit_client_msme" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_msme" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_msme"/>
<columnExists tableName="m_client_msme" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_msme" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_msme" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_msme" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281g_rename_audit_client_mudra_borrower" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_mudra_borrower" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_mudra_borrower"/>
<columnExists tableName="m_client_mudra_borrower" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_mudra_borrower" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_mudra_borrower" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_mudra_borrower" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281h_rename_audit_client_startup_india" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_startup_india" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_startup_india"/>
<columnExists tableName="m_client_startup_india" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_startup_india" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_startup_india" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_startup_india" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
</changeSet>
<changeSet id="0281i_rename_audit_client_eou" author="fineract">
<preConditions onFail="MARK_RAN"><columnExists tableName="m_client_eou" columnName="last_modified_by"/></preConditions>
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_client_eou"/>
<columnExists tableName="m_client_eou" columnName="last_modified_by"/>
</and>
</preConditions>
<renameColumn tableName="m_client_eou" oldColumnName="last_modified_by" newColumnName="modified_by" columnDataType="bigint"/>
<renameColumn tableName="m_client_eou" oldColumnName="created_on_utc" newColumnName="created_at" columnDataType="datetime"/>
<renameColumn tableName="m_client_eou" oldColumnName="last_modified_on_utc" newColumnName="modified_on" columnDataType="datetime"/>
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd">
<changeSet id="0281_update_fd_base_interest_rate_seed_data" author="fineract">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_fd_base_interest_rate_effective"/>
</preConditions>
<sql>
UPDATE m_fd_base_interest_rate_slab_history
SET description = '1 to 29 Days',
from_period = 1,
to_period = 29
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SINGLE' AND version_label = 'FD-SINGLE-V1')
AND sr_no = 1;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '30 to 89 Days',
from_period = 30,
to_period = 89
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SINGLE' AND version_label = 'FD-SINGLE-V1')
AND sr_no = 2;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '90 to 179 Days',
from_period = 90,
to_period = 179
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SINGLE' AND version_label = 'FD-SINGLE-V1')
AND sr_no = 3;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '180+ Days',
from_period = 180,
to_period = NULL
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SINGLE' AND version_label = 'FD-SINGLE-V1')
AND sr_no = 4;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '1 to 2 Years',
from_period = 1,
to_period = 2
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'DOUBLE' AND version_label = 'FD-DOUBLE-V1')
AND sr_no = 1;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '3 to 5 Years',
from_period = 3,
to_period = 5
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'DOUBLE' AND version_label = 'FD-DOUBLE-V1')
AND sr_no = 2;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '6 to 10 Years',
from_period = 6,
to_period = 10
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'DOUBLE' AND version_label = 'FD-DOUBLE-V1')
AND sr_no = 3;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '11+ Years',
from_period = 11,
to_period = NULL
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'DOUBLE' AND version_label = 'FD-DOUBLE-V1')
AND sr_no = 4;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '1 to 12 Months',
from_period = 1,
to_period = 12
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SPECIAL' AND version_label = 'FD-SPECIAL-V1')
AND sr_no = 1;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '13 to 24 Months',
from_period = 13,
to_period = 24
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SPECIAL' AND version_label = 'FD-SPECIAL-V1')
AND sr_no = 2;
UPDATE m_fd_base_interest_rate_slab_history
SET description = '25 to 60 Months',
from_period = 25,
to_period = 60
WHERE effective_id = (SELECT id FROM m_fd_base_interest_rate_effective WHERE fd_type = 'SPECIAL' AND version_label = 'FD-SPECIAL-V1')
AND sr_no = 3;
INSERT INTO m_fd_base_interest_rate_slab_history
(effective_id, sr_no, description, period_type_enum, from_period, to_period, annual_interest_rate, senior_citizen_rate, created_date)
SELECT e.id, 4, '61+ Months', 2, 61, NULL, 7.250000, 7.750000, CURRENT_DATE
FROM m_fd_base_interest_rate_effective e
WHERE e.fd_type = 'SPECIAL' AND e.version_label = 'FD-SPECIAL-V1'
AND NOT EXISTS (
SELECT 1
FROM m_fd_base_interest_rate_slab_history sh
WHERE sh.effective_id = e.id
AND sh.sr_no = 4
);
</sql>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd">
<changeSet id="0284_remove_product_code_unique_constraints" author="system">
<!-- For Savings/RD/FD products -->
<dropUniqueConstraint tableName="m_savings_product" constraintName="m_savings_product_product_code_key"/>
<!-- For Current products -->
<dropUniqueConstraint tableName="m_current_product" constraintName="cp_unq_product_code"/>
<!-- Set existing empty or blank product_codes to NULL to avoid future issues -->
<update tableName="m_savings_product">
<column name="product_code" valueComputed="NULL"/>
<where>product_code = '' OR product_code IS NULL</where>
</update>
<update tableName="m_current_product">
<column name="product_code" valueComputed="NULL"/>
<where>product_code = '' OR product_code IS NULL</where>
</update>
</changeSet>
</databaseChangeLog>
@@ -1,39 +1,24 @@
<?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
-->
<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.1.xsd">
<!--
Enforce uniqueness on m_appuser.email and m_appuser.mobile_no.
Username is already unique (constraint name 'username_org' from the upstream schema).
Email is NOT NULL in the entity; mobile_no IS nullable. Both PostgreSQL and MySQL allow
multiple NULLs in a UNIQUE constraint, so a plain UNIQUE works for mobile_no — multiple
users with no mobile remain valid.
Note: if your existing data already contains duplicate emails or mobiles, this migration
WILL fail. Dedupe first:
SELECT LOWER(email), COUNT(*) FROM m_appuser GROUP BY LOWER(email) HAVING COUNT(*) > 1;
SELECT mobile_no, COUNT(*) FROM m_appuser WHERE mobile_no IS NOT NULL GROUP BY mobile_no HAVING COUNT(*) > 1;
-->
<changeSet id="0295_add_unique_email_to_m_appuser" author="fineract">
<preConditions onFail="MARK_RAN">
<not>
<indexExists tableName="m_appuser" indexName="uq_m_appuser_email"/>
</not>
<sqlCheck expectedResult="0">
SELECT COUNT(*)
FROM (
SELECT LOWER(email)
FROM m_appuser
WHERE email IS NOT NULL
GROUP BY LOWER(email)
HAVING COUNT(*) &gt; 1
) t
</sqlCheck>
</preConditions>
<addUniqueConstraint tableName="m_appuser" columnNames="email"
constraintName="uq_m_appuser_email"/>
@@ -44,8 +29,17 @@
<not>
<indexExists tableName="m_appuser" indexName="uq_m_appuser_mobile_no"/>
</not>
<sqlCheck expectedResult="0">
SELECT COUNT(*)
FROM (
SELECT mobile_no
FROM m_appuser
WHERE mobile_no IS NOT NULL
GROUP BY mobile_no
HAVING COUNT(*) &gt; 1
) t
</sqlCheck>
</preConditions>
<!-- Drop the plain non-unique index added in 0283 first — the unique constraint replaces it. -->
<dropIndex tableName="m_appuser" indexName="idx_m_appuser_mobile_no"/>
<addUniqueConstraint tableName="m_appuser" columnNames="mobile_no"
constraintName="uq_m_appuser_mobile_no"/>
@@ -0,0 +1,47 @@
<?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
-->
<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.1.xsd">
<!--
Fix: previous constraint uq_client_nominee_per_account_type was on
(client_id, nominee_client_id, account_type) — this incorrectly blocked the
same nominee from being added to multiple accounts of the same type
(e.g. two SB accounts). The correct uniqueness is per individual account:
(client_id, nominee_client_id, account_no, account_type).
-->
<changeSet id="0297_fix_unique_nominee_per_account" author="fineract" dbms="postgresql">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_client_nominee"/>
</preConditions>
<sql>
DROP INDEX IF EXISTS uq_client_nominee_per_account_type;
CREATE UNIQUE INDEX IF NOT EXISTS uq_client_nominee_per_account
ON m_client_nominee (client_id, nominee_client_id, account_no, account_type)
WHERE is_deleted = false;
</sql>
<rollback>
<sql>
DROP INDEX IF EXISTS uq_client_nominee_per_account;
CREATE UNIQUE INDEX IF NOT EXISTS uq_client_nominee_per_account_type
ON m_client_nominee (client_id, nominee_client_id, account_type)
WHERE is_deleted = false;
</sql>
</rollback>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.1.xsd">
<changeSet id="0298_unique_external_id_on_current_account" author="CBS">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_current_account"/>
<not><indexExists tableName="m_current_account" indexName="ca_external_id_UNIQUE"/></not>
<not><indexExists tableName="m_current_account" indexName="ca_unq_external_id"/></not>
</preConditions>
<addUniqueConstraint
tableName="m_current_account"
columnNames="external_id"
constraintName="ca_external_id_UNIQUE"/>
</changeSet>
</databaseChangeLog>