Migrate noteTarget and taskTarget to Morph. (#17476)

This PR migrates `noteTarget` and `taskTarget` to morph relations behind
separate feature flags, following the Attachment/TimelineActivity
pattern.

It introduces the `IS_NOTE_TARGET_MIGRATED` and
`IS_TASK_TARGET_MIGRATED` flags, updates standard field metadata and
indexes to use morph relations, and adds two **1.17 workspace
migrations** that:
- rename `noteTarget.*Id` / `taskTarget.*Id` columns to `target*Id`
- convert the corresponding field metadata to `MORPH_RELATION` with a
shared `morphId`

On the frontend, note/task target read and write paths switch to
`target*Id` when the respective flag is enabled. Deleted targets are
filtered on reload to prevent reappearing relations.
This commit is contained in:
Abdullah.
2026-02-04 07:53:06 +05:00
committed by GitHub
parent 9aba2f62e1
commit 7867617385
43 changed files with 1998 additions and 274 deletions
@@ -32,8 +32,8 @@ const morphIdByRelationObjectNameSingular = {
STANDARD_OBJECTS.timelineActivity.morphIds.targetMorphId.morphId,
favorite: null,
attachment: STANDARD_OBJECTS.attachment.morphIds.targetMorphId.morphId,
noteTarget: null,
taskTarget: null,
noteTarget: STANDARD_OBJECTS.noteTarget.morphIds.targetMorphId.morphId,
taskTarget: STANDARD_OBJECTS.taskTarget.morphIds.targetMorphId.morphId,
} satisfies Record<
(typeof DEFAULT_RELATIONS_OBJECTS_STANDARD_IDS)[number],
string | null
@@ -97,6 +97,10 @@ export const buildDefaultRelationFlatFieldMetadatasForCustomObject = ({
]) ||
(objectMetadataNameSingular === 'attachment' &&
existingFeatureFlagsMap[FeatureFlagKey.IS_ATTACHMENT_MIGRATED]) ||
(objectMetadataNameSingular === 'noteTarget' &&
existingFeatureFlagsMap[FeatureFlagKey.IS_NOTE_TARGET_MIGRATED]) ||
(objectMetadataNameSingular === 'taskTarget' &&
existingFeatureFlagsMap[FeatureFlagKey.IS_TASK_TARGET_MIGRATED]) ||
false;
const isObjectMigratedToMorphRelations =
isObjectMigratedFromOlderReleases || isFeatureFlagEnabled;