nominee facility added code update

This commit is contained in:
Nitesh Yadav
2026-05-15 12:59:57 +05:30
parent 167079c2d7
commit 7e0fe99ea6
16 changed files with 42533 additions and 29760 deletions
@@ -18,9 +18,12 @@
<changeSet id="0278b_add_is_mandatory_to_savings_joint_holder" author="system">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_savings_account_joint_holders" columnName="is_mandatory"/>
</not>
<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">
@@ -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"/>
@@ -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"/>
@@ -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"/>