Add Education Level, Degree, Religion, Social Category & Income fields to Client module

- Migration 0256: EducationLevel & DegreeQualification codes with m_client FK columns
- Migration 0257: Religion & SocialCategory codes with m_client FK columns
- Migration 0258: agriculture_income & non_agriculture_income decimal columns on m_client
- Full API support: create, update, template options, and GET response for all new fields
- Postman collection for testing all new dropdowns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Aditya
2026-04-27 16:31:55 +05:30
co-authored by Claude Opus 4.6
parent b4429d04b0
commit 9fb43ad971
12 changed files with 941 additions and 5 deletions
@@ -274,4 +274,7 @@
<include file="parts/0253_add_ckyc_batch_table.xml" relativeToChangelogFile="true"/>
<include file="parts/0254_fix_ckyc_batch_audit_columns.xml" relativeToChangelogFile="true"/>
<include file="parts/0255_add_ckyc_batch_id_to_client_kyc.xml" relativeToChangelogFile="true"/>
<include file="parts/0256_add_education_level_degree_codes.xml" relativeToChangelogFile="true"/>
<include file="parts/0257_add_religion_social_category_codes.xml" relativeToChangelogFile="true"/>
<include file="parts/0258_add_agriculture_non_agriculture_income.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<!-- ==================== EducationLevel code ==================== -->
<changeSet id="0256_01_insert_education_level_code" author="fineract">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'EducationLevel', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'EducationLevel');
</sql>
</changeSet>
<changeSet id="0256_02_insert_education_level_values" author="fineract">
<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
CROSS JOIN (
VALUES
('School', 1),
('Undergraduate', 2),
('Postgraduate', 3),
('Doctorate / Professional', 4)
) AS v(code_value, order_position)
WHERE c.code_name = 'EducationLevel'
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>
<!-- ==================== DegreeQualification code ==================== -->
<changeSet id="0256_03_insert_degree_qualification_code" author="fineract">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'DegreeQualification', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'DegreeQualification');
</sql>
</changeSet>
<changeSet id="0256_04_insert_degree_qualification_values" author="fineract">
<sql>
INSERT INTO m_code_value (code_id, code_value, code_description, order_position, is_active, is_mandatory)
SELECT c.id, v.code_value, v.code_description, v.order_position, true, false
FROM m_code c
CROSS JOIN (
VALUES
('Below 10th', 'School', 1),
('10th / SSC / Matriculation', 'School', 2),
('12th / HSC / Intermediate', 'School', 3),
('Diploma', 'School', 4),
('ITI', 'School', 5),
('B.A. (Bachelor of Arts)', 'Undergraduate', 6),
('B.Sc. (Bachelor of Science)', 'Undergraduate', 7),
('B.Com. (Bachelor of Commerce)', 'Undergraduate', 8),
('BBA (Business Administration)', 'Undergraduate', 9),
('BCA (Computer Applications)', 'Undergraduate', 10),
('B.Tech / B.E. (Engineering)', 'Undergraduate', 11),
('B.Ed. (Education)', 'Undergraduate', 12),
('LLB (Laws)', 'Undergraduate', 13),
('MBBS', 'Undergraduate', 14),
('BDS', 'Undergraduate', 15),
('BAMS', 'Undergraduate', 16),
('BHMS', 'Undergraduate', 17),
('B.Pharm', 'Undergraduate', 18),
('B.Arch', 'Undergraduate', 19),
('BFA (Fine Arts)', 'Undergraduate', 20),
('BHM (Hotel Management)', 'Undergraduate', 21),
('B.Sc. Nursing', 'Undergraduate', 22),
('Other UG', 'Undergraduate', 23),
('M.A. (Master of Arts)', 'Postgraduate', 24),
('M.Sc. (Master of Science)', 'Postgraduate', 25),
('M.Com. (Master of Commerce)', 'Postgraduate', 26),
('MBA (Business Administration)', 'Postgraduate', 27),
('MCA (Computer Applications)', 'Postgraduate', 28),
('M.Tech / M.E. (Engineering)', 'Postgraduate', 29),
('M.Ed. (Education)', 'Postgraduate', 30),
('LLM (Laws)', 'Postgraduate', 31),
('MD (Medicine)', 'Postgraduate', 32),
('MS (Surgery)', 'Postgraduate', 33),
('MDS', 'Postgraduate', 34),
('M.Pharm', 'Postgraduate', 35),
('M.Arch', 'Postgraduate', 36),
('MFA (Fine Arts)', 'Postgraduate', 37),
('MSW (Social Work)', 'Postgraduate', 38),
('Other PG', 'Postgraduate', 39),
('Ph.D. (Doctor of Philosophy)', 'Doctorate / Professional', 40),
('D.Litt.', 'Doctorate / Professional', 41),
('D.Sc.', 'Doctorate / Professional', 42),
('CA (Chartered Accountant)', 'Doctorate / Professional', 43),
('CS (Company Secretary)', 'Doctorate / Professional', 44),
('CMA (Cost &amp; Mgmt Accountant)', 'Doctorate / Professional', 45),
('CFA', 'Doctorate / Professional', 46),
('Other Professional', 'Doctorate / Professional', 47)
) AS v(code_value, code_description, order_position)
WHERE c.code_name = 'DegreeQualification'
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>
<!-- ==================== Add columns to m_client ==================== -->
<changeSet id="0256_05_add_education_columns_to_client" author="fineract">
<addColumn tableName="m_client">
<column name="education_level_cv_id" type="BIGINT"/>
<column name="degree_qualification_cv_id" type="BIGINT"/>
</addColumn>
<addForeignKeyConstraint baseTableName="m_client" baseColumnNames="education_level_cv_id"
constraintName="fk_client_education_level_cv"
referencedTableName="m_code_value" referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="m_client" baseColumnNames="degree_qualification_cv_id"
constraintName="fk_client_degree_qualification_cv"
referencedTableName="m_code_value" referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<!-- ==================== Religion code ==================== -->
<changeSet id="0257_01_insert_religion_code" author="fineract">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'Religion', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'Religion');
</sql>
</changeSet>
<changeSet id="0257_02_insert_religion_values" author="fineract">
<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
CROSS JOIN (
VALUES
('Hindu', 1),
('Muslim', 2),
('Sikh', 3),
('Christian', 4),
('Jain', 5),
('Buddhist', 6),
('Others', 7)
) AS v(code_value, order_position)
WHERE c.code_name = 'Religion'
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>
<!-- ==================== SocialCategory code ==================== -->
<changeSet id="0257_03_insert_social_category_code" author="fineract">
<sql>
INSERT INTO m_code (code_name, is_system_defined)
SELECT 'SocialCategory', false
WHERE NOT EXISTS (SELECT 1 FROM m_code WHERE code_name = 'SocialCategory');
</sql>
</changeSet>
<changeSet id="0257_04_insert_social_category_values" author="fineract">
<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
CROSS JOIN (
VALUES
('General', 1),
('OBC', 2),
('SC', 3),
('ST', 4)
) AS v(code_value, order_position)
WHERE c.code_name = 'SocialCategory'
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>
<!-- ==================== Add columns to m_client ==================== -->
<changeSet id="0257_05_add_religion_social_category_columns_to_client" author="fineract">
<addColumn tableName="m_client">
<column name="religion_cv_id" type="BIGINT"/>
<column name="social_category_cv_id" type="BIGINT"/>
</addColumn>
<addForeignKeyConstraint baseTableName="m_client" baseColumnNames="religion_cv_id"
constraintName="fk_client_religion_cv"
referencedTableName="m_code_value" referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="m_client" baseColumnNames="social_category_cv_id"
constraintName="fk_client_social_category_cv"
referencedTableName="m_code_value" referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<changeSet id="0258_01_add_agriculture_non_agriculture_income" author="fineract">
<addColumn tableName="m_client">
<column name="agriculture_income" type="DECIMAL(19,6)"/>
<column name="non_agriculture_income" type="DECIMAL(19,6)"/>
</addColumn>
</changeSet>
</databaseChangeLog>