Split changesets into small changes (Liquibase #9) 37/141637/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Thu, 24 Jul 2025 14:59:41 +0000 (15:59 +0100)
committerDaniel Hanrahan <daniel.hanrahan@est.tech>
Fri, 1 Aug 2025 10:24:40 +0000 (10:24 +0000)
Following Liquibase best practices, put only related changes into
changesets, preferably one change per changeset.

Issue-ID: POLICY-5398
Change-Id: I0daa7a625f6af9f5ac1531042678759843b9264c
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
runtime-acm/src/main/resources/db/changelog/changelog-1500.yaml
runtime-acm/src/main/resources/db/changelog/changelog-1600.yaml
runtime-acm/src/main/resources/db/changelog/changelog-1601.yaml
runtime-acm/src/main/resources/db/changelog/changelog-1701.yaml
runtime-acm/src/main/resources/db/changelog/changelog-1702.yaml

index 12af985..e42f19f 100644 (file)
@@ -30,14 +30,24 @@ databaseChangeLog:
                 columnName: lastMsg
       changes:
         - sql:
-            sql: |
-              ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now();
-              ALTER TABLE automationcomposition ADD phase SMALLINT DEFAULT 0;
-              UPDATE automationcomposition SET restarting = NULL;
+            sql: ALTER TABLE automationcomposition ADD lastMsg timestamp without time zone DEFAULT Now();
 
   - changeSet:
       id: 1500-2
       author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - not:
+            - columnExists:
+                tableName: automationcomposition
+                columnName: phase
+      changes:
+        - sql:
+            sql: ALTER TABLE automationcomposition ADD phase SMALLINT DEFAULT 0;
+
+  - changeSet:
+      id: 1500-3
+      author: policy
       preConditions:
         - onFail: MARK_RAN
         - not:
@@ -46,12 +56,10 @@ databaseChangeLog:
                 columnName: lastMsg
       changes:
         - sql:
-            sql: |
-              ALTER TABLE automationcompositiondefinition ADD lastMsg timestamp without time zone DEFAULT Now();
-              UPDATE automationcompositiondefinition SET restarting = NULL;
+            sql: ALTER TABLE automationcompositiondefinition ADD lastMsg timestamp without time zone DEFAULT Now();
 
   - changeSet:
-      id: 1500-3
+      id: 1500-4
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -70,7 +78,7 @@ databaseChangeLog:
               );
 
   - changeSet:
-      id: 1500-4
+      id: 1500-5
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -83,7 +91,7 @@ databaseChangeLog:
             sql: ALTER TABLE participant ADD lastMsg timestamp without time zone DEFAULT Now();
 
   - changeSet:
-      id: 1500-5
+      id: 1500-6
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -95,7 +103,7 @@ databaseChangeLog:
             sql: CREATE INDEX participant_replica_fk ON participantreplica(participantId);
 
   - changeSet:
-      id: 1500-6
+      id: 1500-7
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -114,15 +122,49 @@ databaseChangeLog:
                 ON DELETE RESTRICT;
 
   - changeSet:
-      id: 1500-7
+      id: 1500-8
       author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: automationcomposition
+            columnName: restarting
+      changes:
+        - sql:
+            sql: UPDATE automationcomposition SET restarting = NULL;
+
+  - changeSet:
+      id: 1500-9
+      author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: automationcompositiondefinition
+            columnName: restarting
+      changes:
+        - sql:
+            sql: UPDATE automationcompositiondefinition SET restarting = NULL;
+
+  - changeSet:
+      id: 1500-10
+      author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: automationcompositionelement
+            columnName: restarting
       changes:
         - sql:
             sql: UPDATE automationcompositionelement SET restarting = NULL;
 
   - changeSet:
-      id: 1500-8
+      id: 1500-11
       author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: nodetemplatestate
+            columnName: restarting
       changes:
         - sql:
             sql: UPDATE nodetemplatestate SET restarting = NULL;
index db873f5..2b017ec 100644 (file)
@@ -43,6 +43,17 @@ databaseChangeLog:
                 columnName: subState
       changes:
         - sql:
-            sql: |
-              ALTER TABLE automationcompositionelement ADD subState SMALLINT DEFAULT NULL;
-              ALTER TABLE automationcompositionelement ADD stage SMALLINT DEFAULT NULL;
+            sql: ALTER TABLE automationcompositionelement ADD subState SMALLINT DEFAULT NULL;
+
+  - changeSet:
+      id: 1600-3
+      author: policy
+      preConditions:
+        - onFail: MARK_RAN
+        - not:
+            - columnExists:
+                tableName: automationcompositionelement
+                columnName: stage
+      changes:
+        - sql:
+            sql: ALTER TABLE automationcompositionelement ADD stage SMALLINT DEFAULT NULL;
index 604c062..7f57f98 100644 (file)
@@ -31,6 +31,11 @@ databaseChangeLog:
       author: policy
       changes:
         - sql:
-            sql: |
-              UPDATE automationcompositionelement SET subState=0 WHERE subState is NULL;
-              UPDATE automationcompositionelement SET stage=0 WHERE stage is NULL;
+            sql: UPDATE automationcompositionelement SET subState=0 WHERE subState is NULL;
+
+  - changeSet:
+      id: 1601-3
+      author: policy
+      changes:
+        - sql:
+            sql: UPDATE automationcompositionelement SET stage=0 WHERE stage is NULL;
index 1b06f23..1ef507e 100644 (file)
@@ -45,31 +45,67 @@ databaseChangeLog:
             sql: |
               ALTER TABLE automationcomposition ALTER COLUMN compositionid SET NOT NULL;
 
+  - changeSet:
+      id: 1701-3
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcomposition ALTER COLUMN name SET DEFAULT '';
               UPDATE automationcomposition SET name = '' WHERE name IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN name SET NOT NULL;
 
+  - changeSet:
+      id: 1701-4
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcomposition ALTER COLUMN version SET DEFAULT '1.0.0';
               UPDATE automationcomposition SET version = '1.0.0' WHERE version IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN version SET NOT NULL;
 
+  - changeSet:
+      id: 1701-5
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcomposition ALTER COLUMN deployState SET DEFAULT 2;
               UPDATE automationcomposition SET deployState = 2 WHERE deployState IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN deployState SET NOT NULL;
 
+  - changeSet:
+      id: 1701-6
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcomposition ALTER COLUMN lockState SET DEFAULT 4;
               UPDATE automationcomposition SET lockState = 4 WHERE lockState IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN lockState SET NOT NULL;
 
+  - changeSet:
+      id: 1701-7
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcomposition ALTER COLUMN SubState SET DEFAULT 0;
               UPDATE automationcomposition SET subState = 0 WHERE subState IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN SubState SET NOT NULL;
 
+  - changeSet:
+      id: 1701-8
+      author: policy
+      changes:
+        - sql:
+            sql: |
               UPDATE automationcomposition SET lastMsg = now() WHERE lastMsg IS NULL;
               ALTER TABLE automationcomposition ALTER COLUMN lastMsg SET NOT NULL;
 
   - changeSet:
-      id: 1701-3
+      id: 1701-9
       author: policy
       changes:
         - sql:
@@ -78,30 +114,66 @@ databaseChangeLog:
               UPDATE automationcompositionelement SET definition_name = '' WHERE definition_name IS NULL;
               ALTER TABLE automationcompositionelement ALTER COLUMN definition_name SET NOT NULL;
 
+  - changeSet:
+      id: 1701-10
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN definition_version SET DEFAULT '0.0.0';
               UPDATE automationcompositionelement SET definition_version = '0.0.0' WHERE definition_version IS NULL;
               ALTER TABLE automationcompositionelement ALTER COLUMN definition_version SET NOT NULL;
 
+  - changeSet:
+      id: 1701-11
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN deployState SET DEFAULT 2;
               UPDATE automationcompositionelement SET deploystate = 2 WHERE deploystate IS NULL;
               ALTER TABLE automationcompositionelement ALTER COLUMN deploystate SET NOT NULL;
 
+  - changeSet:
+      id: 1701-12
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN lockState SET DEFAULT 4;
               UPDATE automationcompositionelement SET lockState = 4 WHERE lockState IS NULL;
               ALTER TABLE automationcompositionelement ALTER COLUMN lockState SET NOT NULL;
 
+  - changeSet:
+      id: 1701-13
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN substate SET DEFAULT 0;
               UPDATE automationcompositionelement SET subState = 0 WHERE subState IS NULL;
               ALTER TABLE automationcompositionelement ALTER COLUMN substate SET NOT NULL;
 
+  - changeSet:
+      id: 1701-14
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN outproperties SET DEFAULT '{}';
               ALTER TABLE automationcompositionelement ALTER COLUMN outproperties SET NOT NULL;
 
+  - changeSet:
+      id: 1701-15
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositionelement ALTER COLUMN properties SET DEFAULT '{}';
               ALTER TABLE automationcompositionelement ALTER COLUMN properties SET NOT NULL;
 
   - changeSet:
-      id: 1701-4
+      id: 1701-16
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -120,7 +192,7 @@ databaseChangeLog:
                 ON DELETE RESTRICT;
 
   - changeSet:
-      id: 1701-5
+      id: 1701-17
       author: policy
       changes:
         - sql:
@@ -129,23 +201,47 @@ databaseChangeLog:
               UPDATE automationcompositiondefinition SET name = '' WHERE name IS NULL;
               ALTER TABLE automationcompositiondefinition ALTER COLUMN name SET NOT NULL;
 
+  - changeSet:
+      id: 1701-18
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositiondefinition ALTER COLUMN version SET DEFAULT '1.0.0';
               UPDATE automationcompositiondefinition SET version  = '1.0.0' WHERE version IS NULL;
               ALTER TABLE automationcompositiondefinition ALTER COLUMN version SET NOT NULL;
 
+  - changeSet:
+      id: 1701-19
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositiondefinition ALTER COLUMN state SET DEFAULT 0;
               UPDATE automationcompositiondefinition SET state = 0 WHERE state IS NULL;
               ALTER TABLE automationcompositiondefinition ALTER COLUMN state SET NOT NULL;
 
+  - changeSet:
+      id: 1701-20
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE automationcompositiondefinition ALTER COLUMN serviceTemplate SET DEFAULT '';
               UPDATE automationcompositiondefinition SET serviceTemplate = '' WHERE serviceTemplate IS NULL;
               ALTER TABLE automationcompositiondefinition ALTER COLUMN serviceTemplate SET NOT NULL;
 
+  - changeSet:
+      id: 1701-21
+      author: policy
+      changes:
+        - sql:
+            sql: |
               UPDATE automationcompositiondefinition SET lastMsg = now() WHERE lastMsg IS NULL;
               ALTER TABLE automationcompositiondefinition ALTER COLUMN lastMsg SET NOT NULL;
 
   - changeSet:
-      id: 1701-6
+      id: 1701-22
       author: policy
       changes:
         - sql:
@@ -154,20 +250,38 @@ databaseChangeLog:
               UPDATE nodetemplatestate SET nodeTemplate_name  = '' WHERE nodeTemplate_name IS NULL;
               ALTER TABLE nodetemplatestate ALTER COLUMN nodeTemplate_name SET NOT NULL;
 
+  - changeSet:
+      id: 1701-23
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE nodetemplatestate ALTER COLUMN nodeTemplate_version SET DEFAULT '1.0.0';
               UPDATE nodetemplatestate SET nodeTemplate_version = '1.0.0' WHERE nodeTemplate_version IS NULL;
               ALTER TABLE nodetemplatestate ALTER COLUMN nodeTemplate_version SET NOT NULL;
 
+  - changeSet:
+      id: 1701-24
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE nodetemplatestate ALTER COLUMN outProperties SET DEFAULT '{}';
               UPDATE nodetemplatestate SET outProperties = '{}' WHERE outProperties IS NULL;
               ALTER TABLE nodetemplatestate ALTER COLUMN outProperties SET NOT NULL;
 
+  - changeSet:
+      id: 1701-25
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE nodetemplatestate ALTER COLUMN state SET DEFAULT 0;
               UPDATE nodetemplatestate SET state = 0 WHERE state IS NULL;
               ALTER TABLE nodetemplatestate ALTER COLUMN state SET NOT NULL;
 
   - changeSet:
-      id: 1701-7
+      id: 1701-26
       author: policy
       preConditions:
         - onFail: MARK_RAN
@@ -179,7 +293,7 @@ databaseChangeLog:
             sql: CREATE INDEX mb_identificationId_index ON message(identificationId);
 
   - changeSet:
-      id: 1701-8
+      id: 1701-27
       author: policy
       changes:
         - sql:
@@ -187,15 +301,27 @@ databaseChangeLog:
               UPDATE participantreplica SET lastMsg = now() WHERE lastMsg IS NULL;
               ALTER TABLE participantreplica ALTER COLUMN lastMsg SET NOT NULL;
 
+  - changeSet:
+      id: 1701-28
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE participantreplica ALTER COLUMN participantId SET DEFAULT '';
               ALTER TABLE participantreplica ALTER COLUMN participantId SET NOT NULL;
 
+  - changeSet:
+      id: 1701-29
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE participantreplica ALTER COLUMN participantState SET DEFAULT 1;
               UPDATE participantreplica SET participantState = '1' WHERE participantState IS NULL;
               ALTER TABLE participantreplica ALTER COLUMN participantState SET NOT NULL;
 
   - changeSet:
-      id: 1701-9
+      id: 1701-30
       author: policy
       changes:
         - sql:
@@ -203,10 +329,22 @@ databaseChangeLog:
               ALTER TABLE participantsupportedacelements ALTER COLUMN participantId SET DEFAULT '';
               ALTER TABLE participantsupportedacelements ALTER COLUMN participantId SET NOT NULL;
 
+  - changeSet:
+      id: 1701-31
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE participantsupportedacelements ALTER COLUMN typeName SET DEFAULT '';
               UPDATE participantsupportedacelements SET typeName = '' WHERE typeName IS NULL;
               ALTER TABLE participantsupportedacelements ALTER COLUMN typeName SET NOT NULL;
 
+  - changeSet:
+      id: 1701-32
+      author: policy
+      changes:
+        - sql:
+            sql: |
               ALTER TABLE participantsupportedacelements ALTER COLUMN typeVersion SET DEFAULT '1.0.0';
               UPDATE participantsupportedacelements SET typeVersion = '1.0.0' WHERE typeVersion IS NULL;
               ALTER TABLE participantsupportedacelements ALTER COLUMN typeVersion SET NOT NULL;
index b5bff2d..e3be374 100644 (file)
@@ -33,8 +33,6 @@ databaseChangeLog:
             sql: |
               ALTER TABLE automationcomposition
                ADD COLUMN revisionId VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
-              ALTER TABLE automationcomposition ALTER COLUMN phase TYPE INTEGER;
-              ALTER TABLE automationcomposition DROP COLUMN restarting;
 
   - changeSet:
       author: policy
@@ -50,18 +48,55 @@ databaseChangeLog:
             sql: |
               ALTER TABLE automationcompositiondefinition
                ADD COLUMN revisionId VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000';
-              ALTER TABLE automationcompositiondefinition DROP COLUMN restarting;
 
   - changeSet:
       author: policy
       id: 1702-3
       changes:
         - sql:
-            sql: ALTER TABLE automationcompositionelement ALTER COLUMN stage TYPE INTEGER;
+            sql: ALTER TABLE automationcomposition ALTER COLUMN phase TYPE INTEGER;
 
   - changeSet:
       author: policy
       id: 1702-4
+      changes:
+        - sql:
+            sql: ALTER TABLE automationcompositionelement ALTER COLUMN stage TYPE INTEGER;
+
+  - changeSet:
+      author: policy
+      id: 1702-5
+      changes:
+        - sql:
+            sql: ALTER TABLE participantreplica ALTER COLUMN participantId DROP DEFAULT;
+
+  - changeSet:
+      author: policy
+      id: 1702-6
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: automationcomposition
+            columnName: restarting
+      changes:
+        - sql:
+            sql: ALTER TABLE automationcomposition DROP COLUMN restarting;
+
+  - changeSet:
+      author: policy
+      id: 1702-7
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: automationcompositiondefinition
+            columnName: restarting
+      changes:
+        - sql:
+            sql: ALTER TABLE automationcompositiondefinition DROP COLUMN restarting;
+
+  - changeSet:
+      author: policy
+      id: 1702-8
       preConditions:
         - onFail: MARK_RAN
         - columnExists:
@@ -69,13 +104,16 @@ databaseChangeLog:
             columnName: participantState
       changes:
         - sql:
-            sql: |
-              ALTER TABLE participant DROP COLUMN participantState;
-              ALTER TABLE participant DROP COLUMN lastMsg;
+            sql: ALTER TABLE participant DROP COLUMN participantState;
 
   - changeSet:
       author: policy
-      id: 1702-5
+      id: 1702-9
+      preConditions:
+        - onFail: MARK_RAN
+        - columnExists:
+            tableName: participant
+            columnName: lastMsg
       changes:
         - sql:
-            sql: ALTER TABLE participantreplica ALTER COLUMN participantId DROP DEFAULT;
+            sql: ALTER TABLE participant DROP COLUMN lastMsg;