Guards Created on Older Versions Could Have Missing creationType Atributes
Description
Upgrading to Codebeamer release 2.0 or above are affected.
Guards still work but cannot be edited anymore.
Issue to be fixed in upgrade time by PTC planned for 2.1.0.x.
Temporary Fix
SQL script after upgrade to check affection:
SELECT *
FROM object_revision
WHERE type_id = 24 -- Tracker Views
AND JSON_VALUE(description, '$.creationType') IS NULL
AND object_id IN (SELECT DISTINCT JSON_VALUE(ir.description, '$.guard.id') AS guard_id
FROM object_revision ir
WHERE ir.type_id = 23 -- State Transitions
AND JSON_VALUE(ir.description, '$.guard.id') IS NOT NULL);
Healing Script:
UPDATE object_revision
SET description = JSON_TRANSFORM(description, SET '$.creationType' = 'guard')
WHERE type_id = 24 -- Tracker Views
AND JSON_VALUE(description, '$.creationType') IS NULL
AND object_id IN (SELECT DISTINCT JSON_VALUE(ir.description, '$.guard.id') AS guard_id
FROM object_revision ir
WHERE ir.type_id = 23 -- State Transitions
AND JSON_VALUE(ir.description, '$.guard.id') IS NOT NULL);
COMMIT;