Add MorphId column to MORPH_RELATION field metadata (#14285)

close https://github.com/twentyhq/core-team-issues/issues/1426
This commit is contained in:
Paul Rastoin
2025-09-03 18:33:17 +02:00
committed by GitHub
parent 11fd01eaa4
commit 4fa114b3ec
34 changed files with 2614 additions and 2545 deletions
@@ -31,6 +31,7 @@ exports[`Workspace migration builder field actions test suite It should build an
"isUIReadOnly": false,
"isUnique": false,
"label": "flat field metadata label",
"morphId": null,
"name": "flatFieldMetadataName",
"objectMetadataId": Any<String>,
"options": null,
@@ -70,6 +71,7 @@ exports[`Workspace migration builder field actions test suite It should build an
"isUIReadOnly": false,
"isUnique": false,
"label": "flat field metadata label",
"morphId": null,
"name": "flatFieldMetadataName",
"objectMetadataId": Any<String>,
"options": null,
@@ -125,6 +127,7 @@ exports[`Workspace migration builder field actions test suite It should build an
"isUIReadOnly": false,
"isUnique": false,
"label": "flat field metadata label",
"morphId": null,
"name": "flatFieldMetadataName",
"objectMetadataId": Any<String>,
"options": null,
@@ -191,6 +194,7 @@ exports[`Workspace migration builder field actions test suite It should build an
"isUIReadOnly": false,
"isUnique": false,
"label": "flat field metadata label",
"morphId": null,
"name": "flatFieldMetadataName",
"objectMetadataId": Any<String>,
"options": null,
@@ -246,6 +250,7 @@ exports[`Workspace migration builder field actions test suite It should build an
"isUIReadOnly": false,
"isUnique": false,
"label": "flat field metadata label",
"morphId": null,
"name": "flatFieldMetadataName",
"objectMetadataId": Any<String>,
"options": null,
@@ -417,6 +422,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Id",
"morphId": null,
"name": "id",
"objectMetadataId": Any<String>,
"options": null,
@@ -449,6 +455,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Name",
"morphId": null,
"name": "name",
"objectMetadataId": Any<String>,
"options": null,
@@ -481,6 +488,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Creation date",
"morphId": null,
"name": "createdAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -513,6 +521,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Last update",
"morphId": null,
"name": "updatedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -545,6 +554,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Deleted at",
"morphId": null,
"name": "deletedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -580,6 +590,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Created by",
"morphId": null,
"name": "createdBy",
"objectMetadataId": Any<String>,
"options": null,
@@ -612,6 +623,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Position",
"morphId": null,
"name": "position",
"objectMetadataId": Any<String>,
"options": null,
@@ -646,6 +658,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -674,6 +687,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TimelineActivities",
"morphId": null,
"name": "timelineActivities",
"objectMetadataId": Any<String>,
"options": null,
@@ -710,6 +724,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -738,6 +753,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Favorites",
"morphId": null,
"name": "favorites",
"objectMetadataId": Any<String>,
"options": null,
@@ -774,6 +790,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -802,6 +819,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Attachments",
"morphId": null,
"name": "attachments",
"objectMetadataId": Any<String>,
"options": null,
@@ -838,6 +856,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -866,6 +885,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "NoteTargets",
"morphId": null,
"name": "noteTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -902,6 +922,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -930,6 +951,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TaskTargets",
"morphId": null,
"name": "taskTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -964,6 +986,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Search vector",
"morphId": null,
"name": "searchVector",
"objectMetadataId": Any<String>,
"options": null,
@@ -1115,6 +1138,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pet",
"morphId": null,
"name": "pet",
"objectMetadataId": Any<String>,
"options": null,
@@ -1143,6 +1167,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "NoteTargets",
"morphId": null,
"name": "noteTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -1177,6 +1202,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Id",
"morphId": null,
"name": "id",
"objectMetadataId": Any<String>,
"options": null,
@@ -1209,6 +1235,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Name",
"morphId": null,
"name": "name",
"objectMetadataId": Any<String>,
"options": null,
@@ -1241,6 +1268,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Creation date",
"morphId": null,
"name": "createdAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -1273,6 +1301,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Last update",
"morphId": null,
"name": "updatedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -1305,6 +1334,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Deleted at",
"morphId": null,
"name": "deletedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -1340,6 +1370,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Created by",
"morphId": null,
"name": "createdBy",
"objectMetadataId": Any<String>,
"options": null,
@@ -1372,6 +1403,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Position",
"morphId": null,
"name": "position",
"objectMetadataId": Any<String>,
"options": null,
@@ -1406,6 +1438,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pet",
"morphId": null,
"name": "pet",
"objectMetadataId": Any<String>,
"options": null,
@@ -1434,6 +1467,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TimelineActivities",
"morphId": null,
"name": "timelineActivities",
"objectMetadataId": Any<String>,
"options": null,
@@ -1470,6 +1504,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pet",
"morphId": null,
"name": "pet",
"objectMetadataId": Any<String>,
"options": null,
@@ -1498,6 +1533,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Favorites",
"morphId": null,
"name": "favorites",
"objectMetadataId": Any<String>,
"options": null,
@@ -1534,6 +1570,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pet",
"morphId": null,
"name": "pet",
"objectMetadataId": Any<String>,
"options": null,
@@ -1562,6 +1599,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Attachments",
"morphId": null,
"name": "attachments",
"objectMetadataId": Any<String>,
"options": null,
@@ -1598,6 +1636,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pet",
"morphId": null,
"name": "pet",
"objectMetadataId": Any<String>,
"options": null,
@@ -1626,6 +1665,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TaskTargets",
"morphId": null,
"name": "taskTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -1660,6 +1700,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Search vector",
"morphId": null,
"name": "searchVector",
"objectMetadataId": Any<String>,
"options": null,
@@ -1692,6 +1733,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Species",
"morphId": null,
"name": "species",
"objectMetadataId": Any<String>,
"options": [
@@ -1767,6 +1809,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Traits",
"morphId": null,
"name": "traits",
"objectMetadataId": Any<String>,
"options": [
@@ -1842,6 +1885,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Comments",
"morphId": null,
"name": "comments",
"objectMetadataId": Any<String>,
"options": null,
@@ -1874,6 +1918,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Age",
"morphId": null,
"name": "age",
"objectMetadataId": Any<String>,
"options": null,
@@ -1915,6 +1960,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Location",
"morphId": null,
"name": "location",
"objectMetadataId": Any<String>,
"options": null,
@@ -1952,6 +1998,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Vet phone",
"morphId": null,
"name": "vetPhone",
"objectMetadataId": Any<String>,
"options": null,
@@ -1987,6 +2034,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Vet email",
"morphId": null,
"name": "vetEmail",
"objectMetadataId": Any<String>,
"options": null,
@@ -2019,6 +2067,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Birthday",
"morphId": null,
"name": "birthday",
"objectMetadataId": Any<String>,
"options": null,
@@ -2051,6 +2100,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Is good with kids",
"morphId": null,
"name": "isGoodWithKids",
"objectMetadataId": Any<String>,
"options": null,
@@ -2087,6 +2137,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Pictures",
"morphId": null,
"name": "pictures",
"objectMetadataId": Any<String>,
"options": null,
@@ -2122,6 +2173,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Average cost of kibble per month",
"morphId": null,
"name": "averageCostOfKibblePerMonth",
"objectMetadataId": Any<String>,
"options": null,
@@ -2157,6 +2209,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Makes its owner think of",
"morphId": null,
"name": "makesOwnerThinkOf",
"objectMetadataId": Any<String>,
"options": null,
@@ -2189,6 +2242,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Sound swag (bark style, meow style, etc.)",
"morphId": null,
"name": "soundSwag",
"objectMetadataId": Any<String>,
"options": [
@@ -2252,6 +2306,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Bio",
"morphId": null,
"name": "bio",
"objectMetadataId": Any<String>,
"options": null,
@@ -2284,6 +2339,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Interesting facts",
"morphId": null,
"name": "interestingFacts",
"objectMetadataId": Any<String>,
"options": null,
@@ -2316,6 +2372,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Extra data",
"morphId": null,
"name": "extraData",
"objectMetadataId": Any<String>,
"options": null,
@@ -2561,6 +2618,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Id",
"morphId": null,
"name": "id",
"objectMetadataId": Any<String>,
"options": null,
@@ -2593,6 +2651,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Name",
"morphId": null,
"name": "name",
"objectMetadataId": Any<String>,
"options": null,
@@ -2625,6 +2684,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Creation date",
"morphId": null,
"name": "createdAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -2657,6 +2717,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Last update",
"morphId": null,
"name": "updatedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -2689,6 +2750,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Deleted at",
"morphId": null,
"name": "deletedAt",
"objectMetadataId": Any<String>,
"options": null,
@@ -2724,6 +2786,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Created by",
"morphId": null,
"name": "createdBy",
"objectMetadataId": Any<String>,
"options": null,
@@ -2756,6 +2819,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Position",
"morphId": null,
"name": "position",
"objectMetadataId": Any<String>,
"options": null,
@@ -2790,6 +2854,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -2818,6 +2883,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TimelineActivities",
"morphId": null,
"name": "timelineActivities",
"objectMetadataId": Any<String>,
"options": null,
@@ -2854,6 +2920,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -2882,6 +2949,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Favorites",
"morphId": null,
"name": "favorites",
"objectMetadataId": Any<String>,
"options": null,
@@ -2918,6 +2986,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -2946,6 +3015,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Attachments",
"morphId": null,
"name": "attachments",
"objectMetadataId": Any<String>,
"options": null,
@@ -2982,6 +3052,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -3010,6 +3081,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "NoteTargets",
"morphId": null,
"name": "noteTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -3046,6 +3118,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Rocket",
"morphId": null,
"name": "rocket",
"objectMetadataId": Any<String>,
"options": null,
@@ -3074,6 +3147,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "TaskTargets",
"morphId": null,
"name": "taskTargets",
"objectMetadataId": Any<String>,
"options": null,
@@ -3108,6 +3182,7 @@ exports[`Workspace migration builder object actions test suite It should build a
"isUIReadOnly": false,
"isUnique": false,
"label": "Search vector",
"morphId": null,
"name": "searchVector",
"objectMetadataId": Any<String>,
"options": null,
@@ -6,7 +6,7 @@ import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfa
import { COMPANY_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/company-flat-fields.mock';
import { getFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-flat-field-metadata.mock';
import { getMorphOrRelationTargetFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-morph-or-relation-target-flat-field-metadata-mock';
import { getRelationTargetFlatFieldMetadataMock } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/get-morph-or-relation-target-flat-field-metadata-mock';
import { OPPORTUNITY_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/opportunity-flat-fields.mock';
import { PET_FLAT_FIELDS_MOCK } from 'src/engine/metadata-modules/flat-field-metadata/__mocks__/pet-flat-fields.mock';
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
@@ -30,7 +30,7 @@ const relationTestCases: WorkspaceMigrationBuilderTestCase[] = [
const targetRelationId = faker.string.uuid();
const sourceRelationId = faker.string.uuid();
const draftSourceRelationFlatField =
getMorphOrRelationTargetFlatFieldMetadataMock({
getRelationTargetFlatFieldMetadataMock({
id: sourceRelationId,
universalIdentifier: 'field-metadata-unique-identifier-1',
objectMetadataId: PET_FLAT_OBJECT_MOCK.id,