Fix for Liquibase upgrade failure due to NULL participantId 97/142397/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Mon, 10 Nov 2025 14:02:42 +0000 (14:02 +0000)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Mon, 10 Nov 2025 16:50:49 +0000 (16:50 +0000)
This fixes an intermittent upgrade issue when adding not-null
constraints to participant tables due to orphan entries with
NULL values. The fix is to delete rows with NULL entries before
adding the NOT NULL constraints. Since the changesets may have
already been deployed, we need to override the checksums to
avoid Liquibase checksum validation errors.

Issue-ID: POLICY-5486
Change-Id: Ic60b536a1118c3f22e32f04ef0d1c573917c0d20
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
runtime-acm/src/main/resources/db/changelog/changelog-1701.yaml

index 26ed1d4..56e95d3 100644 (file)
@@ -680,11 +680,17 @@ databaseChangeLog:
   - changeSet:
       id: 1701-28
       author: policy
+      # The checksum is needed as this changeset was modified after release to add the delete step.
+      # Otherwise, Liquibase would fail with a checksum validation error when applying to an existing DB.
+      validCheckSum: 9:8ee2b3be1395cf06a05b91faf74b3f80
       changes:
         - addDefaultValue:
             tableName: ParticipantReplica
             columnName: participantId
             defaultValue: ''
+        - delete:
+            tableName: ParticipantReplica
+            where: participantId IS NULL
         - addNotNullConstraint:
             tableName: ParticipantReplica
             columnName: participantId
@@ -725,11 +731,17 @@ databaseChangeLog:
   - changeSet:
       id: 1701-30
       author: policy
+      # The checksum is needed as this changeset was modified after release to add the delete step.
+      # Otherwise, Liquibase would fail with a checksum validation error when applying to an existing DB.
+      validCheckSum: 9:705a8c5532630d8a332c4ecc75952a30
       changes:
         - addDefaultValue:
             tableName: ParticipantSupportedAcElements
             columnName: participantId
             defaultValue: ''
+        - delete:
+            tableName: ParticipantSupportedAcElements
+            where: participantId IS NULL
         - addNotNullConstraint:
             tableName: ParticipantSupportedAcElements
             columnName: participantId