Fix Migrations

This commit is contained in:
Ram Narayan Balaji 2025-09-25 02:21:36 +05:30
parent 25c8abb729
commit 7bf3668dd9

View File

@ -470,11 +470,12 @@ public class MigrationUtil {
""" """
{ {
"type": "automatedTask", "type": "automatedTask",
"subType": "setGlossaryTermStatusTask", "subType": "setEntityAttributeTask",
"name": "SetGlossaryTermStatusToInReviewForUpdate", "name": "SetGlossaryTermStatusToInReviewForUpdate",
"displayName": "Set Status to 'In Review' (Update)", "displayName": "Set Status to 'In Review' (Update)",
"config": { "config": {
"glossaryTermStatus": "In Review" "fieldName": "status",
"fieldValue": "In Review"
}, },
"inputNamespaceMap": { "inputNamespaceMap": {
"relatedEntity": "global", "relatedEntity": "global",
@ -507,8 +508,7 @@ public class MigrationUtil {
"addReviewers": true "addReviewers": true
}, },
"approvalThreshold": 1, "approvalThreshold": 1,
"rejectionThreshold": 1, "rejectionThreshold": 1
"supportsSuggestions": true
}, },
"inputNamespaceMap": { "inputNamespaceMap": {
"relatedEntity": "global" "relatedEntity": "global"
@ -518,7 +518,7 @@ public class MigrationUtil {
""", """,
WorkflowNodeDefinitionInterface.class); WorkflowNodeDefinitionInterface.class);
nodes.add(unifiedApprovalNode); nodes.add(unifiedApprovalNode);
LOG.info("Added new node: ApprovalForUpdates (unified task with suggestions)"); LOG.info("Added new node: ApprovalForUpdates");
nodesAdded = true; nodesAdded = true;
} catch (Exception e) { } catch (Exception e) {
LOG.error("Failed to add ApprovalForUpdates node", e); LOG.error("Failed to add ApprovalForUpdates node", e);
@ -561,11 +561,12 @@ public class MigrationUtil {
""" """
{ {
"type": "automatedTask", "type": "automatedTask",
"subType": "setGlossaryTermStatusTask", "subType": "setEntityAttributeTask",
"name": "SetGlossaryTermStatusToApprovedAfterReview", "name": "SetGlossaryTermStatusToApprovedAfterReview",
"displayName": "Set Status to 'Approved' (After Review)", "displayName": "Set Status to 'Approved' (After Review)",
"config": { "config": {
"glossaryTermStatus": "Approved" "fieldName": "status",
"fieldValue": "Approved"
}, },
"inputNamespaceMap": { "inputNamespaceMap": {
"relatedEntity": "global", "relatedEntity": "global",
@ -837,15 +838,17 @@ public class MigrationUtil {
boolean triggerModified = false; boolean triggerModified = false;
// Check if there's an entityType field (old format) // Check if there's an entityType field (old format)
if (configObj.has("entityType") && !configObj.has("entityTypes")) { if (configObj.has("entityType")) {
String entityType = configObj.get("entityType").asText(); String entityType = configObj.get("entityType").asText();
configObj.remove("entityType");
// Create entityTypes array with the single value // Create entityTypes array with the single value
ArrayNode entityTypesArray = mapper.createArrayNode(); ArrayNode entityTypesArray = mapper.createArrayNode();
entityTypesArray.add(entityType); entityTypesArray.add(entityType);
configObj.set("entityTypes", entityTypesArray); configObj.set("entityTypes", entityTypesArray);
// Remove the old entityType field
configObj.remove("entityType");
LOG.info( LOG.info(
"Updated trigger from entityType='{}' to entityTypes=['{}']", "Updated trigger from entityType='{}' to entityTypes=['{}']",
entityType, entityType,