Skip to content

Conversation

@Monica-CodingWorld
Copy link
Contributor

@Monica-CodingWorld Monica-CodingWorld commented Dec 26, 2025

Description

This PR fixes an invalid Liquibase changelog filename that contained a space in its name.
Liquibase does not support filenames with spaces reliably, which caused build and verification failures.

The change renames the affected changelog file to a space-free name and updates the corresponding reference to ensure consistency and successful execution.

Changes Made

  • Renamed the invalid Liquibase changelog file to match Fineract naming conventions

  • Updated the tenant changelog (changelog-tenant.xml) to reference the corrected file

  • Ensured no functional or logical changes to the database schema itself

  • Updated changelog-tenant.xml to reference the corrected filename

Testing

Ran ./gradlew spotlessApply

Ran ./gradlew build

Verified Liquibase changelog integrity locally

JIRA Ticket

https://issues.apache.org/jira/browse/FINERACT-2423

Checklist

  • Commit message follows Fineract guidelines
  • Code builds successfully locally
  • No functional behavior changes introduced
  • No breaking changes introduced

xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<include file="parts/0003_postgresql_specific_initial_data.xml" relativeToChangelogFile="true"/>
<include file="parts/0004_camelcase_column_renaming.xml" relativeToChangelogFile="true"/>
<include file="parts/0004_camelcase_column_renaming.xml" relativeToChangelogFile="true"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont need this extra space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.
I’ve removed the unnecessary whitespace in changelog-tenant.xml and added a new Liquibase changeset to safely fix the invalid 0072 filename so it won’t be executed twice.
Please let me know if anything else is needed.

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kindly see my concerns!

@Monica-CodingWorld
Copy link
Contributor Author

Thanks for pointing this out, and apologies for the confusion earlier.

I understand your concern now — renaming alone can break existing databases because Liquibase tracks executed changesets by filename.

I am addressing this by adding a new changeset that executes before 0072_add_result_and_status_to_command_source.xml, which updates the filename entry in DATABASECHANGELOG. This ensures:

  • existing databases remain consistent

  • the changeset is not re-executed

  • fresh installations continue to work correctly

I’ll update the PR shortly with this fix. Thanks for your patience and for highlighting this.

@adamsaghy
Copy link
Contributor

Execution failed for task ':spotlessMiscCheck'.
> The following files had format violations:
      fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml
          @@ -35,12 +35,12 @@
           ············Fix·invalid·space·in·Liquibase·changelog·filename·for·Windows·compatibility
           ········</comment>
           
          -·\t<sql>
          -\t····UPDATE·databasechangelog
          -····\t····SET·filename·=·'db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml',
          -············\tmd5sum·=·NULL
          +·····<sql>
          +········UPDATE·databasechangelog
          +············SET·filename·=·'db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml',
          +················md5sum·=·NULL
           ············WHERE·filename·=·'db/changelog/tenant/parts/0072_add_result_and·status_to_command_source.xml';
          -\t</sql>
          +····</sql>
           
           ····</changeSet>
           
  Run './gradlew :spotlessApply' to fix these violations.

Please run ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@Monica-CodingWorld
Copy link
Contributor Author

Please run ./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest

@adamsaghy Thanks for pointing this out.
I have run
./gradlew spotlessApply spotbugsMain spotbugsTest checkstyleMain checkstyleTest
locally and addressed the reported issues.
The latest commit reflects these changes.

@adamsaghy
Copy link
Contributor

I am afraid my advice was not correct... i see it is still failing in some situations.

Let try with this please:

Index: fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml
--- a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml	(revision 6187378e83873aaf3fe911f00f9ea085460dd795)
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0071_1_fix_invalid_filename_for_0072.xml	(date 1767469155355)
@@ -30,17 +30,14 @@
                author="fineract"
                runOnChange="false"
                runAlways="false">
-
         <comment>
             Fix invalid space in Liquibase changelog filename for Windows compatibility
         </comment>
-
-        <sql>
-            UPDATE databasechangelog
-            SET filename = 'db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml'
-            WHERE filename = 'db/changelog/tenant/parts/0072_add_result_and status_to_command_source.xml';
-        </sql>
-
+        <update tableName="DATABASECHANGELOG">
+            <column name="filename" value="db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml"/>
+            <column name="md5sum" />
+            <where>filename = 'db/changelog/tenant/parts/0072_add_result_and status_to_command_source.xml'</where>
+        </update>
     </changeSet>
 
 </databaseChangeLog>
Index: fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
--- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml	(revision 6187378e83873aaf3fe911f00f9ea085460dd795)
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml	(date 1767469466837)
@@ -91,6 +91,7 @@
     <include file="parts/0069_add_unique_constraint_for_reversal_external_id_of_loan_transactions.xml" relativeToChangelogFile="true"/>
     <include file="parts/0070_add_event_configuration_for_delinquency_range_change_event.xml" relativeToChangelogFile="true"/>
     <include file="parts/0071_add_external_id_support_for_loan_transaction.xml" relativeToChangelogFile="true"/>
+    <include file="parts/0071_1_fix_invalid_filename_for_0072.xml" relativeToChangelogFile="true"/>
     <include file="parts/0072_add_result_and_status_to_command_source.xml" relativeToChangelogFile="true" />
     <include file="parts/0073_add_result_status_code_to_command_source.xml" relativeToChangelogFile="true" />
     <include file="parts/0074_add_last_cob_business_date_column_to_loan.xml" relativeToChangelogFile="true"/>
Index: fineract-provider/src/main/resources/db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml
--- a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml	(revision 6187378e83873aaf3fe911f00f9ea085460dd795)
+++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0072_add_result_and_status_to_command_source.xml	(date 1767469344634)
@@ -24,12 +24,14 @@
                    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
 
     <changeSet id="1" author="fineract" context="postgresql">
+        <validCheckSum>9:b1a2065c6c2f9fba5035e700435a80ab</validCheckSum>
         <renameColumn newColumnName="status"
                        oldColumnName="processing_result_enum"
                        tableName="m_portfolio_command_source"/>
     </changeSet>
 
     <changeSet id="2" author="fineract" context="mysql">
+        <validCheckSum>9:9c4456b507915a0ee7a16edca4cddb46</validCheckSum>
         <renameColumn newColumnName="status"
                       oldColumnName="processing_result_enum"
                       tableName="m_portfolio_command_source"
@@ -37,6 +39,7 @@
     </changeSet>
 
     <changeSet id="3" author="fineract">
+        <validCheckSum>9:b5a7d85155d23aadde3403c2d0a8c75d</validCheckSum>
         <addColumn tableName="m_portfolio_command_source">
             <column name="result" type="TEXT"/>
         </addColumn>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants