update current product code and RD code

This commit is contained in:
Nitesh Yadav
2026-04-15 20:34:12 +05:30
parent d7821c7824
commit 2facd3744d
48 changed files with 32602 additions and 1551 deletions
@@ -269,4 +269,6 @@
<include file="parts/0248_add_cin_din_verification_fields.xml" relativeToChangelogFile="true"/>
<include file="parts/0249_add_non_person_extended_fields.xml" relativeToChangelogFile="true"/>
<include file="parts/0251_add_savings_product_enhanced_fields.xml" relativeToChangelogFile="true"/>
<include file="parts/0255_create_current_product_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0256_add_recurring_deposit_product_codes.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,390 @@
<?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.1.xsd">
<!-- Create m_current_product table (same structure as m_savings_product) -->
<changeSet id="0255_create_current_product_table" author="system">
<createTable tableName="m_current_product">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="name" type="varchar(100)">
<constraints nullable="false" unique="true" uniqueConstraintName="cp_unq_name"/>
</column>
<column name="short_name" type="varchar(4)">
<constraints nullable="false" unique="true" uniqueConstraintName="cp_unq_short_name"/>
</column>
<column name="description" type="varchar(500)">
<constraints nullable="false"/>
</column>
<column name="deposit_type_enum" type="smallint" defaultValue="400">
<constraints nullable="false"/>
</column>
<column name="currency_code" type="varchar(3)">
<constraints nullable="false"/>
</column>
<column name="currency_digits" type="smallint">
<constraints nullable="false"/>
</column>
<column name="currency_multiplesof" type="smallint">
<constraints nullable="true"/>
</column>
<column name="nominal_annual_interest_rate" type="decimal(19,6)">
<constraints nullable="false"/>
</column>
<column name="interest_compounding_period_enum" type="smallint">
<constraints nullable="false"/>
</column>
<column name="interest_posting_period_enum" type="smallint" defaultValue="4">
<constraints nullable="false"/>
</column>
<column name="interest_calculation_type_enum" type="smallint">
<constraints nullable="false"/>
</column>
<column name="interest_calculation_days_in_year_type_enum" type="smallint">
<constraints nullable="false"/>
</column>
<column name="min_required_opening_balance" type="decimal(19,6)">
<constraints nullable="true"/>
</column>
<column name="lockin_period_frequency" type="int">
<constraints nullable="true"/>
</column>
<column name="lockin_period_frequency_enum" type="smallint">
<constraints nullable="true"/>
</column>
<column name="accounting_type" type="smallint">
<constraints nullable="false"/>
</column>
<column name="withdrawal_fee_for_transfer" type="boolean" defaultValue="true">
<constraints nullable="false"/>
</column>
<column name="allow_overdraft" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="overdraft_limit" type="decimal(19,6)">
<constraints nullable="true"/>
</column>
<column name="nominal_annual_interest_rate_overdraft" type="decimal(19,6)" defaultValue="0.000000">
<constraints nullable="true"/>
</column>
<column name="min_overdraft_for_interest_calculation" type="decimal(19,6)" defaultValue="0.000000">
<constraints nullable="true"/>
</column>
<column name="enforce_min_required_balance" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="min_required_balance" type="decimal(19,6)">
<constraints nullable="true"/>
</column>
<column name="is_lien_allowed" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="max_allowed_lien_limit" type="decimal(19,6)">
<constraints nullable="true"/>
</column>
<column name="min_balance_for_interest_calculation" type="decimal(19,6)">
<constraints nullable="true"/>
</column>
<column name="withhold_tax" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="tax_group_id" type="bigint">
<constraints nullable="true"/>
</column>
<column name="is_dormancy_tracking_active" type="boolean">
<constraints nullable="true"/>
</column>
<column name="days_to_inactive" type="int">
<constraints nullable="true"/>
</column>
<column name="days_to_dormancy" type="int">
<constraints nullable="true"/>
</column>
<column name="days_to_escheat" type="int">
<constraints nullable="true"/>
</column>
<column name="other_gl_mappings" type="longtext">
<constraints nullable="true"/>
</column>
<!-- Enhanced fields -->
<column name="account_type" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="customer_segment" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="product_code" type="varchar(20)">
<constraints nullable="true" unique="true" uniqueConstraintName="cp_unq_product_code"/>
</column>
<column name="effective_date" type="date">
<constraints nullable="true"/>
</column>
<column name="effective_to" type="date">
<constraints nullable="true"/>
</column>
<column name="end_date" type="date">
<constraints nullable="true"/>
</column>
<column name="introducer_required" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="share_linking_enabled" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="nomination_facility" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="dormancy_alert" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="interest_calculate_selector" type="int">
<constraints nullable="true"/>
</column>
<column name="average_period" type="varchar(20)">
<constraints nullable="true"/>
</column>
<column name="auto_post" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="frequency_fix_day" type="int">
<constraints nullable="true"/>
</column>
<column name="last_interest_date" type="date">
<constraints nullable="true"/>
</column>
<column name="enable_lockin_period" type="boolean" defaultValue="false">
<constraints nullable="false"/>
</column>
<column name="balance_frequency" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="account_closed_zero_balance_in_day_closing" type="boolean" defaultValue="false">
<constraints nullable="true"/>
</column>
</createTable>
<addForeignKeyConstraint baseTableName="m_current_product" baseColumnNames="tax_group_id"
constraintName="fk_current_product_tax_group"
referencedTableName="m_tax_group" referencedColumnNames="id"/>
</changeSet>
<!-- Create m_current_product_charge join table -->
<changeSet id="0256_create_current_product_charge_table" author="system">
<createTable tableName="m_current_product_charge">
<column name="current_product_id" type="bigint">
<constraints nullable="false"/>
</column>
<column name="charge_id" type="bigint">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey tableName="m_current_product_charge" columnNames="current_product_id,charge_id"
constraintName="pk_current_product_charge"/>
<addForeignKeyConstraint baseTableName="m_current_product_charge" baseColumnNames="current_product_id"
constraintName="fk_current_product_charge_product"
referencedTableName="m_current_product" referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="m_current_product_charge" baseColumnNames="charge_id"
constraintName="fk_current_product_charge_charge"
referencedTableName="m_charge" referencedColumnNames="id"/>
</changeSet>
<!-- Create m_current_product_facility_config table -->
<changeSet id="0257_create_current_product_facility_config_table" author="system">
<createTable tableName="m_current_product_facility_config">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="current_product_id" type="bigint">
<constraints nullable="false" unique="true" uniqueConstraintName="uq_current_product_facility_config_product_id"/>
</column>
<column name="atm_facility" type="boolean" defaultValue="false"/>
<column name="atm_withdrawal_facility" type="boolean" defaultValue="false"/>
<column name="upi_facility" type="boolean" defaultValue="false"/>
<column name="pos_transactions_facility" type="boolean" defaultValue="false"/>
<column name="cheque_book" type="boolean" defaultValue="false"/>
<column name="imps_facility" type="boolean" defaultValue="false"/>
<column name="sms_alerts" type="boolean" defaultValue="false"/>
<column name="bbps_facility" type="boolean" defaultValue="false"/>
<column name="insurance_cover" type="boolean" defaultValue="false"/>
<column name="bepg_facility" type="boolean" defaultValue="false"/>
<column name="neft_facility" type="boolean" defaultValue="false"/>
<column name="rtgs_facility" type="boolean" defaultValue="false"/>
<column name="inter_bank_total_cap_facility" type="boolean" defaultValue="false"/>
<column name="withdrawal_facility" type="boolean" defaultValue="false"/>
<column name="deposit_facility_kyc" type="boolean" defaultValue="false"/>
<column name="virtual_debit_card" type="boolean" defaultValue="false"/>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint baseTableName="m_current_product_facility_config" baseColumnNames="current_product_id"
constraintName="fk_current_product_facility_config_product_id"
referencedTableName="m_current_product" referencedColumnNames="id"
onDelete="CASCADE"/>
</changeSet>
<!-- Create m_current_product_facility_limits table -->
<changeSet id="0258_create_current_product_facility_limits_table" author="system">
<createTable tableName="m_current_product_facility_limits">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="current_product_id" type="bigint">
<constraints nullable="false"/>
</column>
<column name="limit_type" type="varchar(100)">
<constraints nullable="false"/>
</column>
<column name="general_limit" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="minor_account_limit" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="small_saving_limit" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint baseTableName="m_current_product_facility_limits" baseColumnNames="current_product_id"
constraintName="fk_current_product_facility_limits_product_id"
referencedTableName="m_current_product" referencedColumnNames="id"
onDelete="CASCADE"/>
<createIndex tableName="m_current_product_facility_limits" indexName="idx_current_product_facility_limits_product_type">
<column name="current_product_id"/>
<column name="limit_type"/>
</createIndex>
</changeSet>
<!-- Create m_current_product_deposit_limit_kyc table -->
<changeSet id="0259_create_current_product_deposit_limit_kyc_table" author="system">
<createTable tableName="m_current_product_deposit_limit_kyc">
<column name="id" type="bigint" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="current_product_id" type="bigint">
<constraints nullable="false" unique="true" uniqueConstraintName="uq_current_product_deposit_limit_kyc_product_id"/>
</column>
<column name="general_kyc_type" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="general_limit" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="minor_kyc_type" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="minor_limit" type="bigint">
<constraints nullable="true"/>
</column>
<column name="small_saving_kyc_type" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="small_saving_limit" type="bigint">
<constraints nullable="true"/>
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
</column>
</createTable>
<addForeignKeyConstraint baseTableName="m_current_product_deposit_limit_kyc" baseColumnNames="current_product_id"
constraintName="fk_current_product_deposit_limit_kyc_product_id"
referencedTableName="m_current_product" referencedColumnNames="id"
onDelete="CASCADE"/>
</changeSet>
<!-- Add new UI fields to m_current_product -->
<changeSet id="0262_add_current_product_new_ui_fields" author="system">
<addColumn tableName="m_current_product">
<column name="balance_swap_option" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="msme" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="auto_debit_facility" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
<column name="avg_balance_calc_period" type="varchar(10)">
<constraints nullable="true"/>
</column>
<column name="valid_for_period" type="varchar(10)">
<constraints nullable="true"/>
</column>
<column name="od_account_closed_zero_balance_in_day_closing" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
<!-- Insert CurrentProductAccountType code and values (separate from SavingsProductAccountType) -->
<changeSet id="0260_add_current_product_account_type_code" author="system">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'CurrentProductAccountType', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'CurrentProductAccountType');
</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
('Standard Account', 1),
('Basic Account', 2),
('Premium Current Account', 3)
) AS v(code_value, order_position)
WHERE c.code_name = 'CurrentProductAccountType'
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>
<!-- Insert CurrentProductCustomerSegment code and values (separate from SavingsProductCustomerSegment) -->
<changeSet id="0261_add_current_product_customer_segment_code" author="system">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'CurrentProductCustomerSegment', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'CurrentProductCustomerSegment');
</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
('Non Individual', 1)
) AS v(code_value, order_position)
WHERE c.code_name = 'CurrentProductCustomerSegment'
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>
@@ -0,0 +1,51 @@
<?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">
<!-- RecurringDepositProductAccountType code and values -->
<changeSet id="0262_add_rd_product_account_type_code" author="system">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'RecurringDepositProductAccountType', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'RecurringDepositProductAccountType');
</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
('Rd Account', 1)
) AS v(code_value, order_position)
WHERE c.code_name = 'RecurringDepositProductAccountType'
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>
<!-- RecurringDepositProductCustomerSegment code and values -->
<changeSet id="0263_add_rd_product_customer_segment_code" author="system">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'RecurringDepositProductCustomerSegment', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'RecurringDepositProductCustomerSegment');
</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 = 'RecurringDepositProductCustomerSegment'
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>