From 235eef32f679c40c442ae40ef9a08ad66d11a08f Mon Sep 17 00:00:00 2001 From: Paul Rastoin <45004772+prastoin@users.noreply.github.com> Date: Thu, 18 Sep 2025 14:42:01 +0200 Subject: [PATCH] Improve builder return type (#14592) We need grain in orchestrator over actions ordering for upcoming index integration to v2 --- ...ty-orchestrator-actions-report.constant.ts | 18 + ...ce-migration-build-orchestrator.service.ts | 39 +- .../workspace-migration-orchestrator.type.ts | 8 + .../workspace-migration-builder.spec.ts.snap | 5641 +++++++++-------- ...space-migration-builder-field-test-case.ts | 21 - ...pace-migration-builder-object-test-case.ts | 22 - ...kspace-migration-builder-test-case.type.ts | 1 - .../workspace-migration-builder.spec.ts | 69 +- ...ace-entity-migration-builder-v2.service.ts | 25 +- .../workspace-migration-builder-v2.service.ts | 39 +- 10 files changed, 3010 insertions(+), 2873 deletions(-) create mode 100644 packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/constant/empty-orchestrator-actions-report.constant.ts diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/constant/empty-orchestrator-actions-report.constant.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/constant/empty-orchestrator-actions-report.constant.ts new file mode 100644 index 0000000000..7522c194f8 --- /dev/null +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/constant/empty-orchestrator-actions-report.constant.ts @@ -0,0 +1,18 @@ +import { type OrchestratorActionsReport } from 'src/engine/workspace-manager/workspace-migration-v2/types/workspace-migration-orchestrator.type'; +import { type CreatedDeletedUpdatedActions } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service'; +import { type WorkspaceMigrationActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-action-common-v2'; + +const emptyCreatedDeletedUpdated: CreatedDeletedUpdatedActions = + { + created: [], + deleted: [], + updated: [], + }; + +export const EMPTY_ORCHESTRATOR_ACTIONS_REPORT = { + index: emptyCreatedDeletedUpdated, + objectMetadata: emptyCreatedDeletedUpdated, + view: emptyCreatedDeletedUpdated, + viewField: emptyCreatedDeletedUpdated, + fieldMetadata: emptyCreatedDeletedUpdated, +} as const satisfies OrchestratorActionsReport; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/services/workspace-migration-build-orchestrator.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/services/workspace-migration-build-orchestrator.service.ts index 14cd18a0a9..e3c3556905 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/services/workspace-migration-build-orchestrator.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/services/workspace-migration-build-orchestrator.service.ts @@ -4,6 +4,7 @@ import { isDefined } from 'twenty-shared/utils'; import { EMPTY_ALL_FLAT_ENTITY_MAPS } from 'src/engine/core-modules/common/constant/empty-all-flat-entity-maps.constant'; import { AllFlatEntityMaps } from 'src/engine/core-modules/common/types/all-flat-entity-maps.type'; +import { EMPTY_ORCHESTRATOR_ACTIONS_REPORT } from 'src/engine/workspace-manager/workspace-migration-v2/constant/empty-orchestrator-actions-report.constant'; import { OrchestratorFailureReport, WorkspaceMigrationOrchestratorBuildArgs, @@ -14,7 +15,6 @@ import { WorkspaceMigrationV2IndexActionsBuilderService } from 'src/engine/works import { WorkspaceMigrationV2ViewFieldActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/view-field/workspace-migration-v2-view-field-actions-builder.service'; import { WorkspaceMigrationV2ViewActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/view/workspace-migration-v2-view-actions-builder.service'; import { WorkspaceMigrationBuilderV2Service } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service'; -import { WorkspaceMigrationActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-action-common-v2'; @Injectable() export class WorkspaceMigrationBuildOrchestratorService { @@ -69,7 +69,9 @@ export class WorkspaceMigrationBuildOrchestratorService { | WorkspaceMigrationOrchestratorFailedResult | WorkspaceMigrationOrchestratorSuccessfulResult > { - const allActions: WorkspaceMigrationActionV2[] = []; + const orchestratorActionsReport = structuredClone({ + ...EMPTY_ORCHESTRATOR_ACTIONS_REPORT, + }); const orchestratorFailureReport: OrchestratorFailureReport = { objectMetadata: [], view: [], @@ -96,7 +98,6 @@ export class WorkspaceMigrationBuildOrchestratorService { await this.workspaceMigrationBuilderV2Service.validateAndBuild({ fromFlatObjectMetadataMaps, toFlatObjectMetadataMaps, - workspaceId, buildOptions, }); @@ -106,7 +107,8 @@ export class WorkspaceMigrationBuildOrchestratorService { if (objectResult.status === 'fail') { orchestratorFailureReport.objectMetadata.push(...objectResult.errors); } else { - allActions.push(...objectResult.workspaceMigration.actions); + orchestratorActionsReport.fieldMetadata = objectResult.fieldsActions; + orchestratorActionsReport.objectMetadata = objectResult.objectActions; } } @@ -131,7 +133,7 @@ export class WorkspaceMigrationBuildOrchestratorService { if (indexResult.status === 'fail') { orchestratorFailureReport.index.push(...indexResult.errors); } else { - allActions.push(...indexResult.actions); + orchestratorActionsReport.index = indexResult.actions; } } @@ -156,7 +158,7 @@ export class WorkspaceMigrationBuildOrchestratorService { if (viewResult.status === 'fail') { orchestratorFailureReport.view.push(...viewResult.errors); } else { - allActions.push(...viewResult.actions); + orchestratorActionsReport.view = viewResult.actions; } } @@ -183,7 +185,7 @@ export class WorkspaceMigrationBuildOrchestratorService { if (viewFieldResult.status === 'fail') { orchestratorFailureReport.viewField.push(...viewFieldResult.errors); } else { - allActions.push(...viewFieldResult.actions); + orchestratorActionsReport.viewField = viewFieldResult.actions; } } @@ -204,7 +206,28 @@ export class WorkspaceMigrationBuildOrchestratorService { status: 'success', workspaceMigration: { relatedFlatEntityMapsKeys, - actions: allActions, + actions: [ + // Object and fields + ...orchestratorActionsReport.fieldMetadata.deleted, + ...orchestratorActionsReport.index.deleted, + ...orchestratorActionsReport.objectMetadata.deleted, + ...orchestratorActionsReport.objectMetadata.created, + ...orchestratorActionsReport.index.created, + ...orchestratorActionsReport.objectMetadata.updated, + ...orchestratorActionsReport.fieldMetadata.created, + ...orchestratorActionsReport.fieldMetadata.updated, + ...orchestratorActionsReport.index.updated, + /// + + // Views + ...orchestratorActionsReport.view.deleted, + ...orchestratorActionsReport.view.created, + ...orchestratorActionsReport.view.updated, + ...orchestratorActionsReport.viewField.deleted, + ...orchestratorActionsReport.viewField.created, + ...orchestratorActionsReport.viewField.updated, + /// + ], workspaceId, }, }; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/types/workspace-migration-orchestrator.type.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/types/workspace-migration-orchestrator.type.ts index 5dd4b65a88..bba49c3cbc 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/types/workspace-migration-orchestrator.type.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/types/workspace-migration-orchestrator.type.ts @@ -3,7 +3,9 @@ import { type FromTo } from 'twenty-shared/types'; import { type AllFlatEntitiesByMetadataEngineName } from 'src/engine/core-modules/common/types/all-flat-entities-by-metadata-engine-name.type'; import { type AllFlatEntityMaps } from 'src/engine/core-modules/common/types/all-flat-entity-maps.type'; import { type FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/types/failed-flat-entity-validation.type'; +import { type CreatedDeletedUpdatedActions } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service'; import { type WorkspaceMigrationV2BuilderOptions } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service'; +import { type WorkspaceMigrationActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-action-common-v2'; import { type WorkspaceMigrationV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-v2'; export type WorkspaceMigrationOrchestratorBuildArgs = { @@ -21,6 +23,12 @@ export type OrchestratorFailureReport = { >[]; }; +export type OrchestratorActionsReport = { + [P in keyof AllFlatEntitiesByMetadataEngineName]: CreatedDeletedUpdatedActions; +} & { + fieldMetadata: CreatedDeletedUpdatedActions; +}; + export type WorkspaceMigrationOrchestratorFailedResult = { status: 'fail'; report: OrchestratorFailureReport; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/__snapshots__/workspace-migration-builder.spec.ts.snap b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/__snapshots__/workspace-migration-builder.spec.ts.snap index 626930b4e3..4642ca0812 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/__snapshots__/workspace-migration-builder.spec.ts.snap +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/__snapshots__/workspace-migration-builder.spec.ts.snap @@ -1,66 +1,53 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Workspace migration builder field actions test suite It should NOT build an update_field action for a field RELATION uncovered fields mutation 1`] = `[]`; +exports[`Workspace migration builder field actions test suite It should NOT build an update_field action for a field RELATION uncovered fields mutation 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should NOT build an update_field action for a field RELATION uncovered fields mutation 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; exports[`Workspace migration builder field actions test suite It should build a delete_field action 1`] = ` -[ - { - "fieldMetadataId": Any, - "objectMetadataId": Any, - "type": "delete_field", - }, -] +{ + "created": [], + "deleted": [ + { + "fieldMetadataId": Any, + "objectMetadataId": Any, + "type": "delete_field", + }, + ], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build a delete_field action 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} `; exports[`Workspace migration builder field actions test suite It should build an create_field action 1`] = ` -[ - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "default flat field metadata description", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "icon", - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "flat field metadata label", - "morphId": null, - "name": "flatFieldMetadataName", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, -] -`; - -exports[`Workspace migration builder field actions test suite It should build an create_field action for a RELATION field 1`] = ` -[ - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "default flat field metadata description", - "flatRelationTargetFieldMetadata": { +{ + "created": [ + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, "description": "default flat field metadata description", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, "icon": "icon", "id": Any, "isActive": true, @@ -75,87 +62,72 @@ exports[`Workspace migration builder field actions test suite It should build an "name": "flatFieldMetadataName", "objectMetadataId": Any, "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "sourceWhatever", - "onDelete": undefined, - "relationType": "ONE_TO_MANY", - }, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, "standardId": null, "standardOverrides": null, - "type": "RELATION", + "type": "TEXT", "universalIdentifier": Any, "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": { - "createdAt": Any, - "description": "A rocket", - "duplicateCriteria": null, - "icon": "IconRocket", - "id": Any, - "imageIdentifierFieldMetadataId": null, - "isActive": true, - "isAuditLogged": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isRemote": false, - "isSearchable": true, - "isSystem": false, - "isUIReadOnly": false, - "labelIdentifierFieldMetadataId": Any, - "labelPlural": "Rockets", - "labelSingular": "Rocket", - "namePlural": "rockets", - "nameSingular": "rocket", - "shortcut": null, - "standardId": null, - "standardOverrides": null, - "targetTableName": "DEPRECATED", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "icon": "icon", - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "flat field metadata label", - "morphId": null, - "name": "flatFieldMetadataName", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "whatever", - "onDelete": undefined, - "relationType": "MANY_TO_ONE", - }, - "standardId": null, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "default flat field metadata description", - "flatRelationTargetFieldMetadata": { + ], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an create_field action 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an create_field action for a RELATION field 1`] = ` +{ + "created": [ + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, "description": "default flat field metadata description", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "default flat field metadata description", + "icon": "icon", + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "flat field metadata label", + "morphId": null, + "name": "flatFieldMetadataName", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "sourceWhatever", + "onDelete": undefined, + "relationType": "ONE_TO_MANY", + }, + "standardId": null, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, "flatRelationTargetObjectMetadata": { "createdAt": Any, "description": "A rocket", @@ -212,7 +184,2195 @@ exports[`Workspace migration builder field actions test suite It should build an "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": { + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "default flat field metadata description", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "default flat field metadata description", + "flatRelationTargetObjectMetadata": { + "createdAt": Any, + "description": "A rocket", + "duplicateCriteria": null, + "icon": "IconRocket", + "id": Any, + "imageIdentifierFieldMetadataId": null, + "isActive": true, + "isAuditLogged": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isRemote": false, + "isSearchable": true, + "isSystem": false, + "isUIReadOnly": false, + "labelIdentifierFieldMetadataId": Any, + "labelPlural": "Rockets", + "labelSingular": "Rocket", + "namePlural": "rockets", + "nameSingular": "rocket", + "shortcut": null, + "standardId": null, + "standardOverrides": null, + "targetTableName": "DEPRECATED", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "icon": "icon", + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "flat field metadata label", + "morphId": null, + "name": "flatFieldMetadataName", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "whatever", + "onDelete": undefined, + "relationType": "MANY_TO_ONE", + }, + "standardId": null, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": { + "createdAt": Any, + "description": null, + "duplicateCriteria": null, + "icon": "IconCat", + "id": Any, + "imageIdentifierFieldMetadataId": null, + "isActive": true, + "isAuditLogged": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isRemote": false, + "isSearchable": true, + "isSystem": false, + "isUIReadOnly": false, + "labelIdentifierFieldMetadataId": Any, + "labelPlural": "Pets", + "labelSingular": "Pet", + "namePlural": "pets", + "nameSingular": "pet", + "shortcut": null, + "standardId": null, + "standardOverrides": null, + "targetTableName": "DEPRECATED", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "icon": "icon", + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "flat field metadata label", + "morphId": null, + "name": "flatFieldMetadataName", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "sourceWhatever", + "onDelete": undefined, + "relationType": "ONE_TO_MANY", + }, + "standardId": null, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + ], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an create_field action for a RELATION field 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for a RELATION field 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [ + { + "fieldMetadataId": Any, + "objectMetadataId": Any, + "type": "update_field", + "updates": [ + { + "from": null, + "property": "description", + "to": "new description", + }, + { + "from": "Species", + "property": "label", + "to": "new label", + }, + ], + "workspaceId": Any, + }, + ], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for a RELATION field 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for custom fields 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [ + { + "fieldMetadataId": Any, + "objectMetadataId": Any, + "type": "update_field", + "updates": [ + { + "from": null, + "property": "description", + "to": "new description", + }, + { + "from": null, + "property": "icon", + "to": "new icon", + }, + ], + "workspaceId": Any, + }, + ], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for custom fields 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for standard field 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [ + { + "fieldMetadataId": Any, + "objectMetadataId": Any, + "type": "update_field", + "updates": [ + { + "from": null, + "property": "standardOverrides", + "to": { + "description": "new description", + "icon": "new icon", + }, + }, + ], + "workspaceId": Any, + }, + ], +} +`; + +exports[`Workspace migration builder field actions test suite It should build an update_field action for standard field 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should not infer any actions as from and to fields are identical 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder field actions test suite It should not infer any actions as from and to fields are identical 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a create_object action with custom object 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a create_object action with custom object 2`] = ` +{ + "created": [ + { + "createFieldActions": [ + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "uuid", + "description": "Id", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "Icon123", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Id", + "morphId": null, + "name": "id", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "UUID", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "'Untitled'", + "description": "Name", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconAbc", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Name", + "morphId": null, + "name": "name", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TEXT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Creation date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendar", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Creation date", + "morphId": null, + "name": "createdAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Last time the record was changed", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Last update", + "morphId": null, + "name": "updatedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Deletion date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Deleted at", + "morphId": null, + "name": "deletedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "name": "''", + "source": "'MANUAL'", + }, + "description": "The creator of the record", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCreativeCommonsSa", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Created by", + "morphId": null, + "name": "createdBy", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "ACTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": 0, + "description": "Position", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHierarchy2", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Position", + "morphId": null, + "name": "position", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "POSITION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconTimelineEvent", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "TimelineActivities", + "morphId": null, + "name": "timelineActivities", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Favorites tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Favorites Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHeart", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Favorites", + "morphId": null, + "name": "favorites", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Attachments tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Attachments Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconFileImport", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Attachments", + "morphId": null, + "name": "attachments", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "NoteTargets tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "NoteTargets Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "NoteTargets", + "morphId": null, + "name": "noteTargets", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TaskTargets tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TaskTargets Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "TaskTargets", + "morphId": null, + "name": "taskTargets", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Field used for full-text search", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": false, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Search vector", + "morphId": null, + "name": "searchVector", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TS_VECTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + ], + "flatObjectMetadataWithoutFields": { + "createdAt": Any, + "description": "A rocket", + "duplicateCriteria": null, + "icon": "IconRocket", + "id": Any, + "imageIdentifierFieldMetadataId": null, + "isActive": true, + "isAuditLogged": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isRemote": false, + "isSearchable": true, + "isSystem": false, + "isUIReadOnly": false, + "labelIdentifierFieldMetadataId": Any, + "labelPlural": "Rockets", + "labelSingular": "Rocket", + "namePlural": "rockets", + "nameSingular": "rocket", + "shortcut": null, + "standardId": null, + "standardOverrides": null, + "targetTableName": "DEPRECATED", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_object", + }, + ], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a create_object action with standard object 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a create_object action with standard object 2`] = ` +{ + "created": [ + { + "createFieldActions": [ + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "NoteTargets tied to the Pet", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "NoteTargets Pet", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pet", + "morphId": null, + "name": "pet", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "petId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "NoteTargets", + "morphId": null, + "name": "noteTargets", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "uuid", + "description": "Id", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "Icon123", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Id", + "morphId": null, + "name": "id", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "UUID", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "'Untitled'", + "description": "Name", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconAbc", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Name", + "morphId": null, + "name": "name", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TEXT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Creation date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendar", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Creation date", + "morphId": null, + "name": "createdAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Last time the record was changed", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Last update", + "morphId": null, + "name": "updatedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Deletion date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Deleted at", + "morphId": null, + "name": "deletedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "name": "''", + "source": "'MANUAL'", + }, + "description": "The creator of the record", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCreativeCommonsSa", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Created by", + "morphId": null, + "name": "createdBy", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "ACTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": 0, + "description": "Position", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHierarchy2", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Position", + "morphId": null, + "name": "position", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "POSITION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities tied to the Pet", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities Pet", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pet", + "morphId": null, + "name": "pet", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "petId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconTimelineEvent", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "TimelineActivities", + "morphId": null, + "name": "timelineActivities", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Favorites tied to the Pet", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Favorites Pet", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pet", + "morphId": null, + "name": "pet", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "petId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHeart", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Favorites", + "morphId": null, + "name": "favorites", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Attachments tied to the Pet", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Attachments Pet", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pet", + "morphId": null, + "name": "pet", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "petId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconFileImport", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Attachments", + "morphId": null, + "name": "attachments", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TaskTargets tied to the Pet", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TaskTargets Pet", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pet", + "morphId": null, + "name": "pet", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "petId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "TaskTargets", + "morphId": null, + "name": "taskTargets", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "relationType": "ONE_TO_MANY", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Field used for full-text search", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": false, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Search vector", + "morphId": null, + "name": "searchVector", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TS_VECTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Species", + "morphId": null, + "name": "species", + "objectMetadataId": Any, + "options": [ + { + "color": "blue", + "id": Any, + "label": "Dog", + "position": 0, + "value": "DOG", + }, + { + "color": "red", + "id": Any, + "label": "Cat", + "position": 1, + "value": "CAT", + }, + { + "color": "green", + "id": Any, + "label": "Bird", + "position": 2, + "value": "BIRD", + }, + { + "color": "yellow", + "id": Any, + "label": "Fish", + "position": 3, + "value": "FISH", + }, + { + "color": "purple", + "id": Any, + "label": "Rabbit", + "position": 4, + "value": "RABBIT", + }, + { + "color": "orange", + "id": Any, + "label": "Hamster", + "position": 5, + "value": "HAMSTER", + }, + ], + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "SELECT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Traits", + "morphId": null, + "name": "traits", + "objectMetadataId": Any, + "options": [ + { + "color": "blue", + "id": Any, + "label": "Playful", + "position": 0, + "value": "PLAYFUL", + }, + { + "color": "red", + "id": Any, + "label": "Friendly", + "position": 1, + "value": "FRIENDLY", + }, + { + "color": "green", + "id": Any, + "label": "Protective", + "position": 2, + "value": "PROTECTIVE", + }, + { + "color": "yellow", + "id": Any, + "label": "Shy", + "position": 3, + "value": "SHY", + }, + { + "color": "purple", + "id": Any, + "label": "Brave", + "position": 4, + "value": "BRAVE", + }, + { + "color": "orange", + "id": Any, + "label": "Curious", + "position": 5, + "value": "CURIOUS", + }, + ], + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "MULTI_SELECT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "''", + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Comments", + "morphId": null, + "name": "comments", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "TEXT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Age", + "morphId": null, + "name": "age", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "NUMBER", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "addressCity": "''", + "addressCountry": "''", + "addressLat": null, + "addressLng": null, + "addressPostcode": "''", + "addressState": "''", + "addressStreet1": "''", + "addressStreet2": "''", + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Location", + "morphId": null, + "name": "location", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "ADDRESS", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "additionalPhones": null, + "primaryPhoneCallingCode": "''", + "primaryPhoneCountryCode": "''", + "primaryPhoneNumber": "''", + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Vet phone", + "morphId": null, + "name": "vetPhone", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "PHONES", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "additionalEmails": null, + "primaryEmail": "''", + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Vet email", + "morphId": null, + "name": "vetEmail", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "EMAILS", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Birthday", + "morphId": null, + "name": "birthday", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "DATE", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Is good with kids", + "morphId": null, + "name": "isGoodWithKids", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "BOOLEAN", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "primaryLinkLabel": "''", + "primaryLinkUrl": "''", + "secondaryLinks": [], + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Pictures", + "morphId": null, + "name": "pictures", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "LINKS", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "amountMicros": null, + "currencyCode": "''", + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Average cost of kibble per month", + "morphId": null, + "name": "averageCostOfKibblePerMonth", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "CURRENCY", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "firstName": "''", + "lastName": "''", + }, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Makes its owner think of", + "morphId": null, + "name": "makesOwnerThinkOf", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "FULL_NAME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Sound swag (bark style, meow style, etc.)", + "morphId": null, + "name": "soundSwag", + "objectMetadataId": Any, + "options": [ + { + "id": Any, + "label": "1", + "position": 0, + "value": "RATING_1", + }, + { + "id": Any, + "label": "2", + "position": 1, + "value": "RATING_2", + }, + { + "id": Any, + "label": "3", + "position": 2, + "value": "RATING_3", + }, + { + "id": Any, + "label": "4", + "position": 3, + "value": "RATING_4", + }, + { + "id": Any, + "label": "5", + "position": 4, + "value": "RATING_5", + }, + ], + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "RATING", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Bio", + "morphId": null, + "name": "bio", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "RICH_TEXT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Interesting facts", + "morphId": null, + "name": "interestingFacts", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "ARRAY", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": null, + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Extra data", + "morphId": null, + "name": "extraData", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": null, + "standardOverrides": null, + "type": "RAW_JSON", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + ], + "flatObjectMetadataWithoutFields": { "createdAt": Any, "description": null, "duplicateCriteria": null, @@ -240,2298 +2400,300 @@ exports[`Workspace migration builder field actions test suite It should build an "updatedAt": Any, "workspaceId": Any, }, - "icon": "icon", - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "flat field metadata label", - "morphId": null, - "name": "flatFieldMetadataName", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "sourceWhatever", - "onDelete": undefined, - "relationType": "ONE_TO_MANY", - }, - "standardId": null, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_object", }, - "type": "create_field", - }, -] -`; - -exports[`Workspace migration builder field actions test suite It should build an update_field action for a RELATION field 1`] = ` -[ - { - "fieldMetadataId": Any, - "objectMetadataId": Any, - "type": "update_field", - "updates": [ - { - "from": null, - "property": "description", - "to": "new description", - }, - { - "from": "Species", - "property": "label", - "to": "new label", - }, - ], - "workspaceId": Any, - }, -] -`; - -exports[`Workspace migration builder field actions test suite It should build an update_field action for custom fields 1`] = ` -[ - { - "fieldMetadataId": Any, - "objectMetadataId": Any, - "type": "update_field", - "updates": [ - { - "from": null, - "property": "description", - "to": "new description", - }, - { - "from": null, - "property": "icon", - "to": "new icon", - }, - ], - "workspaceId": Any, - }, -] -`; - -exports[`Workspace migration builder field actions test suite It should build an update_field action for standard field 1`] = ` -[ - { - "fieldMetadataId": Any, - "objectMetadataId": Any, - "type": "update_field", - "updates": [ - { - "from": null, - "property": "standardOverrides", - "to": { - "description": "new description", - "icon": "new icon", - }, - }, - ], - "workspaceId": Any, - }, -] -`; - -exports[`Workspace migration builder field actions test suite It should not infer any actions as from and to fields are identical 1`] = `[]`; - -exports[`Workspace migration builder object actions test suite It should build a create_object action with custom object 1`] = ` -[ - { - "createFieldActions": [ - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "uuid", - "description": "Id", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "Icon123", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Id", - "morphId": null, - "name": "id", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "UUID", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "'Untitled'", - "description": "Name", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconAbc", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Name", - "morphId": null, - "name": "name", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Creation date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendar", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Creation date", - "morphId": null, - "name": "createdAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Last time the record was changed", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Last update", - "morphId": null, - "name": "updatedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Deletion date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Deleted at", - "morphId": null, - "name": "deletedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "name": "''", - "source": "'MANUAL'", - }, - "description": "The creator of the record", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCreativeCommonsSa", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Created by", - "morphId": null, - "name": "createdBy", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "ACTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": 0, - "description": "Position", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHierarchy2", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Position", - "morphId": null, - "name": "position", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "POSITION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TimelineActivities tied to the Rocket", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TimelineActivities Rocket", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Rocket", - "morphId": null, - "name": "rocket", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconTimelineEvent", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TimelineActivities", - "morphId": null, - "name": "timelineActivities", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Favorites tied to the Rocket", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Favorites Rocket", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Rocket", - "morphId": null, - "name": "rocket", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHeart", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Favorites", - "morphId": null, - "name": "favorites", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Attachments tied to the Rocket", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Attachments Rocket", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Rocket", - "morphId": null, - "name": "rocket", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconFileImport", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Attachments", - "morphId": null, - "name": "attachments", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "NoteTargets tied to the Rocket", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "NoteTargets Rocket", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Rocket", - "morphId": null, - "name": "rocket", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "NoteTargets", - "morphId": null, - "name": "noteTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TaskTargets tied to the Rocket", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TaskTargets Rocket", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Rocket", - "morphId": null, - "name": "rocket", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TaskTargets", - "morphId": null, - "name": "taskTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Field used for full-text search", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": false, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Search vector", - "morphId": null, - "name": "searchVector", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TS_VECTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - ], - "flatObjectMetadataWithoutFields": { - "createdAt": Any, - "description": "A rocket", - "duplicateCriteria": null, - "icon": "IconRocket", - "id": Any, - "imageIdentifierFieldMetadataId": null, - "isActive": true, - "isAuditLogged": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isRemote": false, - "isSearchable": true, - "isSystem": false, - "isUIReadOnly": false, - "labelIdentifierFieldMetadataId": Any, - "labelPlural": "Rockets", - "labelSingular": "Rocket", - "namePlural": "rockets", - "nameSingular": "rocket", - "shortcut": null, - "standardId": null, - "standardOverrides": null, - "targetTableName": "DEPRECATED", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_object", - }, -] -`; - -exports[`Workspace migration builder object actions test suite It should build a create_object action with standard object 1`] = ` -[ - { - "createFieldActions": [ - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "NoteTargets tied to the Pet", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "NoteTargets Pet", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pet", - "morphId": null, - "name": "pet", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "petId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "NoteTargets", - "morphId": null, - "name": "noteTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "uuid", - "description": "Id", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "Icon123", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Id", - "morphId": null, - "name": "id", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "UUID", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "'Untitled'", - "description": "Name", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconAbc", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Name", - "morphId": null, - "name": "name", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Creation date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendar", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Creation date", - "morphId": null, - "name": "createdAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Last time the record was changed", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Last update", - "morphId": null, - "name": "updatedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Deletion date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Deleted at", - "morphId": null, - "name": "deletedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "name": "''", - "source": "'MANUAL'", - }, - "description": "The creator of the record", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCreativeCommonsSa", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Created by", - "morphId": null, - "name": "createdBy", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "ACTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": 0, - "description": "Position", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHierarchy2", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Position", - "morphId": null, - "name": "position", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "POSITION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TimelineActivities tied to the Pet", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TimelineActivities Pet", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pet", - "morphId": null, - "name": "pet", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "petId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconTimelineEvent", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TimelineActivities", - "morphId": null, - "name": "timelineActivities", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Favorites tied to the Pet", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Favorites Pet", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pet", - "morphId": null, - "name": "pet", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "petId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHeart", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Favorites", - "morphId": null, - "name": "favorites", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Attachments tied to the Pet", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Attachments Pet", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pet", - "morphId": null, - "name": "pet", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "petId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconFileImport", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Attachments", - "morphId": null, - "name": "attachments", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TaskTargets tied to the Pet", - "flatRelationTargetFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TaskTargets Pet", - "icon": "IconBuildingSkyscraper", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pet", - "morphId": null, - "name": "pet", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "joinColumnName": "petId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TaskTargets", - "morphId": null, - "name": "taskTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Field used for full-text search", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": false, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Search vector", - "morphId": null, - "name": "searchVector", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TS_VECTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Species", - "morphId": null, - "name": "species", - "objectMetadataId": Any, - "options": [ - { - "color": "blue", - "id": Any, - "label": "Dog", - "position": 0, - "value": "DOG", - }, - { - "color": "red", - "id": Any, - "label": "Cat", - "position": 1, - "value": "CAT", - }, - { - "color": "green", - "id": Any, - "label": "Bird", - "position": 2, - "value": "BIRD", - }, - { - "color": "yellow", - "id": Any, - "label": "Fish", - "position": 3, - "value": "FISH", - }, - { - "color": "purple", - "id": Any, - "label": "Rabbit", - "position": 4, - "value": "RABBIT", - }, - { - "color": "orange", - "id": Any, - "label": "Hamster", - "position": 5, - "value": "HAMSTER", - }, - ], - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "SELECT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Traits", - "morphId": null, - "name": "traits", - "objectMetadataId": Any, - "options": [ - { - "color": "blue", - "id": Any, - "label": "Playful", - "position": 0, - "value": "PLAYFUL", - }, - { - "color": "red", - "id": Any, - "label": "Friendly", - "position": 1, - "value": "FRIENDLY", - }, - { - "color": "green", - "id": Any, - "label": "Protective", - "position": 2, - "value": "PROTECTIVE", - }, - { - "color": "yellow", - "id": Any, - "label": "Shy", - "position": 3, - "value": "SHY", - }, - { - "color": "purple", - "id": Any, - "label": "Brave", - "position": 4, - "value": "BRAVE", - }, - { - "color": "orange", - "id": Any, - "label": "Curious", - "position": 5, - "value": "CURIOUS", - }, - ], - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "MULTI_SELECT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "''", - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Comments", - "morphId": null, - "name": "comments", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Age", - "morphId": null, - "name": "age", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "NUMBER", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "addressCity": "''", - "addressCountry": "''", - "addressLat": null, - "addressLng": null, - "addressPostcode": "''", - "addressState": "''", - "addressStreet1": "''", - "addressStreet2": "''", - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Location", - "morphId": null, - "name": "location", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "ADDRESS", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "additionalPhones": null, - "primaryPhoneCallingCode": "''", - "primaryPhoneCountryCode": "''", - "primaryPhoneNumber": "''", - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Vet phone", - "morphId": null, - "name": "vetPhone", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "PHONES", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "additionalEmails": null, - "primaryEmail": "''", - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Vet email", - "morphId": null, - "name": "vetEmail", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "EMAILS", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Birthday", - "morphId": null, - "name": "birthday", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "DATE", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Is good with kids", - "morphId": null, - "name": "isGoodWithKids", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "BOOLEAN", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "primaryLinkLabel": "''", - "primaryLinkUrl": "''", - "secondaryLinks": [], - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Pictures", - "morphId": null, - "name": "pictures", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "LINKS", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "amountMicros": null, - "currencyCode": "''", - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Average cost of kibble per month", - "morphId": null, - "name": "averageCostOfKibblePerMonth", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "CURRENCY", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "firstName": "''", - "lastName": "''", - }, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Makes its owner think of", - "morphId": null, - "name": "makesOwnerThinkOf", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "FULL_NAME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Sound swag (bark style, meow style, etc.)", - "morphId": null, - "name": "soundSwag", - "objectMetadataId": Any, - "options": [ - { - "id": Any, - "label": "1", - "position": 0, - "value": "RATING_1", - }, - { - "id": Any, - "label": "2", - "position": 1, - "value": "RATING_2", - }, - { - "id": Any, - "label": "3", - "position": 2, - "value": "RATING_3", - }, - { - "id": Any, - "label": "4", - "position": 3, - "value": "RATING_4", - }, - { - "id": Any, - "label": "5", - "position": 4, - "value": "RATING_5", - }, - ], - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "RATING", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Bio", - "morphId": null, - "name": "bio", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "RICH_TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Interesting facts", - "morphId": null, - "name": "interestingFacts", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "ARRAY", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": null, - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Extra data", - "morphId": null, - "name": "extraData", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": null, - "standardOverrides": null, - "type": "RAW_JSON", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - ], - "flatObjectMetadataWithoutFields": { - "createdAt": Any, - "description": null, - "duplicateCriteria": null, - "icon": "IconCat", - "id": Any, - "imageIdentifierFieldMetadataId": null, - "isActive": true, - "isAuditLogged": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isRemote": false, - "isSearchable": true, - "isSystem": false, - "isUIReadOnly": false, - "labelIdentifierFieldMetadataId": Any, - "labelPlural": "Pets", - "labelSingular": "Pet", - "namePlural": "pets", - "nameSingular": "pet", - "shortcut": null, - "standardId": null, - "standardOverrides": null, - "targetTableName": "DEPRECATED", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_object", - }, -] + ], + "deleted": [], + "updated": [], +} `; exports[`Workspace migration builder object actions test suite It should build a create_object and create_index actions for each of this fieldMetadata 1`] = ` -[ - { - "createFieldActions": [ - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "uuid", - "description": "Id", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "Icon123", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Id", - "morphId": null, - "name": "id", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "UUID", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "'Untitled'", - "description": "Name", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconAbc", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Name", - "morphId": null, - "name": "name", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TEXT", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Creation date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendar", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Creation date", - "morphId": null, - "name": "createdAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": "now", - "description": "Last time the record was changed", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Last update", - "morphId": null, - "name": "updatedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Deletion date", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCalendarClock", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Deleted at", - "morphId": null, - "name": "deletedAt", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "DATE_TIME", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": { - "name": "''", - "source": "'MANUAL'", +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a create_object and create_index actions for each of this fieldMetadata 2`] = ` +{ + "created": [ + { + "createFieldActions": [ + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "uuid", + "description": "Id", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "Icon123", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Id", + "morphId": null, + "name": "id", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "UUID", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, }, - "description": "The creator of the record", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCreativeCommonsSa", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": false, - "isUIReadOnly": false, - "isUnique": false, - "label": "Created by", - "morphId": null, - "name": "createdBy", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "ACTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": 0, - "description": "Position", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHierarchy2", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": false, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Position", - "morphId": null, - "name": "position", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "POSITION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "'Untitled'", + "description": "Name", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconAbc", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Name", + "morphId": null, + "name": "name", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TEXT", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TimelineActivities tied to the Rocket", - "flatRelationTargetFieldMetadata": { + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Creation date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendar", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Creation date", + "morphId": null, + "name": "createdAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": "now", + "description": "Last time the record was changed", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Last update", + "morphId": null, + "name": "updatedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, - "description": "TimelineActivities Rocket", - "icon": "IconBuildingSkyscraper", + "description": "Deletion date", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCalendarClock", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Deleted at", + "morphId": null, + "name": "deletedAt", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "DATE_TIME", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": { + "name": "''", + "source": "'MANUAL'", + }, + "description": "The creator of the record", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCreativeCommonsSa", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": false, + "isUIReadOnly": false, + "isUnique": false, + "label": "Created by", + "morphId": null, + "name": "createdBy", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "ACTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": 0, + "description": "Position", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHierarchy2", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": false, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Position", + "morphId": null, + "name": "position", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "POSITION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TimelineActivities Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconTimelineEvent", "id": Any, "isActive": true, "isCustom": false, @@ -2540,17 +2702,15 @@ exports[`Workspace migration builder object actions test suite It should build a "isSystem": true, "isUIReadOnly": false, "isUnique": false, - "label": "Rocket", + "label": "TimelineActivities", "morphId": null, - "name": "rocket", + "name": "timelineActivities", "objectMetadataId": Any, "options": null, "relationTargetFieldMetadataId": Any, "relationTargetObjectMetadataId": Any, "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", + "relationType": "ONE_TO_MANY", }, "standardId": Any, "standardOverrides": null, @@ -2559,45 +2719,47 @@ exports[`Workspace migration builder object actions test suite It should build a "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconTimelineEvent", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TimelineActivities", - "morphId": null, - "name": "timelineActivities", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Favorites tied to the Rocket", - "flatRelationTargetFieldMetadata": { + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, - "description": "Favorites Rocket", - "icon": "IconBuildingSkyscraper", + "description": "Favorites tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Favorites Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconHeart", "id": Any, "isActive": true, "isCustom": false, @@ -2606,17 +2768,15 @@ exports[`Workspace migration builder object actions test suite It should build a "isSystem": true, "isUIReadOnly": false, "isUnique": false, - "label": "Rocket", + "label": "Favorites", "morphId": null, - "name": "rocket", + "name": "favorites", "objectMetadataId": Any, "options": null, "relationTargetFieldMetadataId": Any, "relationTargetObjectMetadataId": Any, "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", + "relationType": "ONE_TO_MANY", }, "standardId": Any, "standardOverrides": null, @@ -2625,45 +2785,47 @@ exports[`Workspace migration builder object actions test suite It should build a "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconHeart", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Favorites", - "morphId": null, - "name": "favorites", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Attachments tied to the Rocket", - "flatRelationTargetFieldMetadata": { + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, - "description": "Attachments Rocket", - "icon": "IconBuildingSkyscraper", + "description": "Attachments tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Attachments Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconFileImport", "id": Any, "isActive": true, "isCustom": false, @@ -2672,17 +2834,15 @@ exports[`Workspace migration builder object actions test suite It should build a "isSystem": true, "isUIReadOnly": false, "isUnique": false, - "label": "Rocket", + "label": "Attachments", "morphId": null, - "name": "rocket", + "name": "attachments", "objectMetadataId": Any, "options": null, "relationTargetFieldMetadataId": Any, "relationTargetObjectMetadataId": Any, "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", + "relationType": "ONE_TO_MANY", }, "standardId": Any, "standardOverrides": null, @@ -2691,45 +2851,47 @@ exports[`Workspace migration builder object actions test suite It should build a "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconFileImport", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Attachments", - "morphId": null, - "name": "attachments", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "NoteTargets tied to the Rocket", - "flatRelationTargetFieldMetadata": { + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, - "description": "NoteTargets Rocket", - "icon": "IconBuildingSkyscraper", + "description": "NoteTargets tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "NoteTargets Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", "id": Any, "isActive": true, "isCustom": false, @@ -2738,17 +2900,15 @@ exports[`Workspace migration builder object actions test suite It should build a "isSystem": true, "isUIReadOnly": false, "isUnique": false, - "label": "Rocket", + "label": "NoteTargets", "morphId": null, - "name": "rocket", + "name": "noteTargets", "objectMetadataId": Any, "options": null, "relationTargetFieldMetadataId": Any, "relationTargetObjectMetadataId": Any, "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", + "relationType": "ONE_TO_MANY", }, "standardId": Any, "standardOverrides": null, @@ -2757,45 +2917,47 @@ exports[`Workspace migration builder object actions test suite It should build a "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "NoteTargets", - "morphId": null, - "name": "noteTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", - }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", - }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "TaskTargets tied to the Rocket", - "flatRelationTargetFieldMetadata": { + { + "flatFieldMetadata": { "createdAt": Any, "defaultValue": null, - "description": "TaskTargets Rocket", - "icon": "IconBuildingSkyscraper", + "description": "TaskTargets tied to the Rocket", + "flatRelationTargetFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "TaskTargets Rocket", + "icon": "IconBuildingSkyscraper", + "id": Any, + "isActive": true, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Rocket", + "morphId": null, + "name": "rocket", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": Any, + "relationTargetObjectMetadataId": Any, + "settings": { + "joinColumnName": "rocketId", + "onDelete": "CASCADE", + "relationType": "MANY_TO_ONE", + }, + "standardId": Any, + "standardOverrides": null, + "type": "RELATION", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, + }, + "flatRelationTargetObjectMetadata": null, + "icon": "IconCheckbox", "id": Any, "isActive": true, "isCustom": false, @@ -2804,17 +2966,15 @@ exports[`Workspace migration builder object actions test suite It should build a "isSystem": true, "isUIReadOnly": false, "isUnique": false, - "label": "Rocket", + "label": "TaskTargets", "morphId": null, - "name": "rocket", + "name": "taskTargets", "objectMetadataId": Any, "options": null, "relationTargetFieldMetadataId": Any, "relationTargetObjectMetadataId": Any, "settings": { - "joinColumnName": "rocketId", - "onDelete": "CASCADE", - "relationType": "MANY_TO_ONE", + "relationType": "ONE_TO_MANY", }, "standardId": Any, "standardOverrides": null, @@ -2823,174 +2983,195 @@ exports[`Workspace migration builder object actions test suite It should build a "updatedAt": Any, "workspaceId": Any, }, - "flatRelationTargetObjectMetadata": null, - "icon": "IconCheckbox", - "id": Any, - "isActive": true, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "TaskTargets", - "morphId": null, - "name": "taskTargets", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": Any, - "relationTargetObjectMetadataId": Any, - "settings": { - "relationType": "ONE_TO_MANY", + "type": "create_field", + }, + { + "flatFieldMetadata": { + "createdAt": Any, + "defaultValue": null, + "description": "Field used for full-text search", + "flatRelationTargetFieldMetadata": null, + "flatRelationTargetObjectMetadata": null, + "icon": null, + "id": Any, + "isActive": false, + "isCustom": false, + "isLabelSyncedWithName": false, + "isNullable": true, + "isSystem": true, + "isUIReadOnly": false, + "isUnique": false, + "label": "Search vector", + "morphId": null, + "name": "searchVector", + "objectMetadataId": Any, + "options": null, + "relationTargetFieldMetadataId": null, + "relationTargetObjectMetadataId": null, + "settings": null, + "standardId": Any, + "standardOverrides": null, + "type": "TS_VECTOR", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, }, - "standardId": Any, - "standardOverrides": null, - "type": "RELATION", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_field", }, - "type": "create_field", + ], + "flatObjectMetadataWithoutFields": { + "createdAt": Any, + "description": "A rocket", + "duplicateCriteria": null, + "icon": "IconRocket", + "id": Any, + "imageIdentifierFieldMetadataId": null, + "isActive": true, + "isAuditLogged": true, + "isCustom": true, + "isLabelSyncedWithName": false, + "isRemote": false, + "isSearchable": true, + "isSystem": false, + "isUIReadOnly": false, + "labelIdentifierFieldMetadataId": Any, + "labelPlural": "Rockets", + "labelSingular": "Rocket", + "namePlural": "rockets", + "nameSingular": "rocket", + "shortcut": null, + "standardId": null, + "standardOverrides": null, + "targetTableName": "DEPRECATED", + "universalIdentifier": Any, + "updatedAt": Any, + "workspaceId": Any, }, - { - "flatFieldMetadata": { - "createdAt": Any, - "defaultValue": null, - "description": "Field used for full-text search", - "flatRelationTargetFieldMetadata": null, - "flatRelationTargetObjectMetadata": null, - "icon": null, - "id": Any, - "isActive": false, - "isCustom": false, - "isLabelSyncedWithName": false, - "isNullable": true, - "isSystem": true, - "isUIReadOnly": false, - "isUnique": false, - "label": "Search vector", - "morphId": null, - "name": "searchVector", - "objectMetadataId": Any, - "options": null, - "relationTargetFieldMetadataId": null, - "relationTargetObjectMetadataId": null, - "settings": null, - "standardId": Any, - "standardOverrides": null, - "type": "TS_VECTOR", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_field", - }, - ], - "flatObjectMetadataWithoutFields": { - "createdAt": Any, - "description": "A rocket", - "duplicateCriteria": null, - "icon": "IconRocket", - "id": Any, - "imageIdentifierFieldMetadataId": null, - "isActive": true, - "isAuditLogged": true, - "isCustom": true, - "isLabelSyncedWithName": false, - "isRemote": false, - "isSearchable": true, - "isSystem": false, - "isUIReadOnly": false, - "labelIdentifierFieldMetadataId": Any, - "labelPlural": "Rockets", - "labelSingular": "Rocket", - "namePlural": "rockets", - "nameSingular": "rocket", - "shortcut": null, - "standardId": null, - "standardOverrides": null, - "targetTableName": "DEPRECATED", - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, + "type": "create_object", }, - "type": "create_object", - }, - { - "flatIndexMetadata": { - "createdAt": Any, - "flatIndexFieldMetadatas": [], - "id": Any, - "indexType": "BTREE", - "indexWhereClause": null, - "isCustom": false, - "isUnique": false, - "name": "defaultFlatIndexMetadataName", - "objectMetadataId": Any, - "universalIdentifier": Any, - "updatedAt": Any, - "workspaceId": Any, - }, - "type": "create_index", - }, -] + ], + "deleted": [], + "updated": [], +} `; exports[`Workspace migration builder object actions test suite It should build a delete_object action with custom deactivated object 1`] = ` -[ - { - "objectMetadataId": Any, - "type": "delete_object", - }, -] +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a delete_object action with custom deactivated object 2`] = ` +{ + "created": [], + "deleted": [ + { + "objectMetadataId": Any, + "type": "delete_object", + }, + ], + "updated": [], +} `; exports[`Workspace migration builder object actions test suite It should build a delete_object action with standard activated object 1`] = ` -[ - { - "objectMetadataId": Any, - "type": "delete_object", - }, -] +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build a delete_object action with standard activated object 2`] = ` +{ + "created": [], + "deleted": [ + { + "objectMetadataId": Any, + "type": "delete_object", + }, + ], + "updated": [], +} `; exports[`Workspace migration builder object actions test suite It should build an update_object for custom object 1`] = ` -[ - { - "objectMetadataId": Any, - "type": "update_object", - "updates": [ - { - "from": "pets", - "property": "namePlural", - "to": "prastoins", - }, - { - "from": "pet", - "property": "nameSingular", - "to": "prastouin", - }, - ], - }, -] +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should build an update_object for custom object 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [ + { + "objectMetadataId": Any, + "type": "update_object", + "updates": [ + { + "from": "pets", + "property": "namePlural", + "to": "prastoins", + }, + { + "from": "pet", + "property": "nameSingular", + "to": "prastouin", + }, + ], + }, + ], +} `; exports[`Workspace migration builder object actions test suite It should build an update_object for standard object 1`] = ` -[ - { - "objectMetadataId": Any, - "type": "update_object", - "updates": [ - { - "from": null, - "property": "standardOverrides", - "to": { - "description": "Updated description", - }, - }, - ], - }, -] +{ + "created": [], + "deleted": [], + "updated": [], +} `; -exports[`Workspace migration builder object actions test suite It should not infer any actions as from and to are identical 1`] = `[]`; +exports[`Workspace migration builder object actions test suite It should build an update_object for standard object 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [ + { + "objectMetadataId": Any, + "type": "update_object", + "updates": [ + { + "from": null, + "property": "standardOverrides", + "to": { + "description": "Updated description", + }, + }, + ], + }, + ], +} +`; + +exports[`Workspace migration builder object actions test suite It should not infer any actions as from and to are identical 1`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; + +exports[`Workspace migration builder object actions test suite It should not infer any actions as from and to are identical 2`] = ` +{ + "created": [], + "deleted": [], + "updated": [], +} +`; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-field-test-case.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-field-test-case.ts index d8d84100f0..2f1ae652dc 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-field-test-case.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-field-test-case.ts @@ -19,9 +19,6 @@ import { ROCKET_FLAT_OBJECT_MOCK } from 'src/engine/metadata-modules/flat-object import { type WorkspaceMigrationBuilderTestCase } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type'; import { fromFlatObjectMetadataToFlatObjectMetadataWithoutFields } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/utils/from-flat-object-metadata-to-flat-object-metadata-without-fields.util'; -// TODO prastoin test defaultValue and settings updates -// TODO prastoin test standard abstraction in TDD style - const relationTestCases: WorkspaceMigrationBuilderTestCase[] = [ { title: 'It should build an create_field action for a RELATION field', @@ -92,9 +89,6 @@ const relationTestCases: WorkspaceMigrationBuilderTestCase[] = [ toFlatObjectMetadataMaps, }; }, - expectedActionsTypeCounter: { - createField: 2, - }, }, }, { @@ -112,9 +106,6 @@ const relationTestCases: WorkspaceMigrationBuilderTestCase[] = [ flatObjectMetadataMaps: FLAT_OBJECT_METADATA_MAPS_MOCKS, }), }, - expectedActionsTypeCounter: { - updateField: 1, - }, }, }, { @@ -159,9 +150,6 @@ const basicCrudTestCases: WorkspaceMigrationBuilderTestCase[] = [ flatObjectMetadataMaps: FLAT_OBJECT_METADATA_MAPS_MOCKS, }), }, - expectedActionsTypeCounter: { - createField: 1, - }, }, }, { @@ -181,9 +169,6 @@ const basicCrudTestCases: WorkspaceMigrationBuilderTestCase[] = [ }), }), }, - expectedActionsTypeCounter: { - updateField: 1, - }, }, }, { @@ -201,9 +186,6 @@ const basicCrudTestCases: WorkspaceMigrationBuilderTestCase[] = [ }), }), }, - expectedActionsTypeCounter: { - updateField: 1, - }, }, }, { @@ -224,9 +206,6 @@ const basicCrudTestCases: WorkspaceMigrationBuilderTestCase[] = [ flatObjectMetadataMaps: FLAT_OBJECT_METADATA_MAPS_MOCKS, }), }, - expectedActionsTypeCounter: { - deleteField: 1, - }, }, }, ]; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-object-test-case.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-object-test-case.ts index 5fe98548f4..0ffd13c000 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-object-test-case.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-object-test-case.ts @@ -33,9 +33,6 @@ const DELETE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ }, ), }, - expectedActionsTypeCounter: { - deleteObject: 1, - }, }, }, { @@ -55,9 +52,6 @@ const DELETE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ }, ), }, - expectedActionsTypeCounter: { - deleteObject: 1, - }, }, }, ]; @@ -79,9 +73,6 @@ const CREATE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ ...STANDARD_RELATION_TARGET_FLAT_OBJECT_METADATA_MOCKS, ]), }, - expectedActionsTypeCounter: { - createObject: 1, - }, }, }, { @@ -100,19 +91,12 @@ const CREATE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ ...STANDARD_RELATION_TARGET_FLAT_OBJECT_METADATA_MOCKS, ]), }, - expectedActionsTypeCounter: { - createObject: 1, - }, }, }, { title: 'It should build a create_object and create_index actions for each of this fieldMetadata', context: { - expectedActionsTypeCounter: { - createIndex: 1, - createObject: 1, - }, input: { fromFlatObjectMetadataMaps: fromFlatObjectMetadatasToFlatObjectMetadataMaps([ @@ -153,9 +137,6 @@ const UPDATE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ }), }), }, - expectedActionsTypeCounter: { - updateObject: 1, - }, }, }, { @@ -174,9 +155,6 @@ const UPDATE_OBJECT_TEST_CASES: WorkspaceMigrationBuilderTestCase[] = [ }), }), }, - expectedActionsTypeCounter: { - updateObject: 1, - }, }, }, ]; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type.ts index a286969391..c0e4f523bc 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type.ts @@ -21,5 +21,4 @@ export type WorkspaceMigrationBuilderTestCase = EachTestingContext<{ input: | TestWorkspaceMigrationBuildArgs | (() => TestWorkspaceMigrationBuildArgs); - expectedActionsTypeCounter?: ExpectedActionCounters; }>; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/workspace-migration-builder.spec.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/workspace-migration-builder.spec.ts index 2ed03184ec..1421099bd9 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/workspace-migration-builder.spec.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/workspace-migration-builder.spec.ts @@ -1,6 +1,5 @@ import { extractRecordIdsAndDatesAsExpectAny } from 'test/utils/extract-record-ids-and-dates-as-expect-any'; import { eachTestingContextFilter } from 'twenty-shared/testing'; -import { capitalize } from 'twenty-shared/utils'; import { type FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; import { FlatFieldMetadataTypeValidatorService } from 'src/engine/metadata-modules/flat-field-metadata/services/flat-field-metadata-type-validator.service'; @@ -8,15 +7,11 @@ import { FlatFieldMetadataValidatorService } from 'src/engine/metadata-modules/f import { FlatObjectMetadataValidatorService } from 'src/engine/metadata-modules/flat-object-metadata/services/flat-object-metadata-validator.service'; import { WORKSPACE_MIGRATION_FIELD_BUILDER_TEST_CASES } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-field-test-case'; import { WORKSPACE_MIGRATION_OBJECT_BUILDER_TEST_CASES } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/common/workspace-migration-builder-object-test-case'; -import { - type CamelCasedWorkspaceMigrationActionsType, - type ExpectedActionCounters, - type WorkspaceMigrationBuilderTestCase, -} from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type'; +import { type WorkspaceMigrationBuilderTestCase } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/__tests__/types/workspace-migration-builder-test-case.type'; import { WorkspaceMigrationV2FieldActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/field/services/workspace-migration-v2-field-actions-builder.service'; import { WorkspaceMigrationV2ObjectActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/object/services/workspace-migration-v2-object-actions-builder.service'; import { WorkspaceMigrationBuilderV2Service } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service'; -import { type WorkspaceMigrationV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-v2'; +``; const allWorkspaceBuilderTestCases: { label: string; @@ -32,45 +27,6 @@ const allWorkspaceBuilderTestCases: { }, ]; -// TODO prastoin add coverage to infer deletion from missing entities -const expectedActionsTypeCounterChecker = ({ - expectedActionsTypeCounter, - workspaceMigration, -}: { - workspaceMigration: WorkspaceMigrationV2; - expectedActionsTypeCounter?: ExpectedActionCounters; -}) => { - const initialAcc: ExpectedActionCounters = { - createField: 0, - createIndex: 0, - createObject: 0, - deleteField: 0, - deleteIndex: 0, - deleteObject: 0, - updateField: 0, - updateObject: 0, - }; - const actualActionsTypeCounter = workspaceMigration.actions.reduce( - (acc, action) => { - const { type } = action; - const [operation, target] = type.split('_'); - const formattedActionKey = - `${operation}${capitalize(target)}` as CamelCasedWorkspaceMigrationActionsType; - - return { - ...acc, - [formattedActionKey]: (acc[formattedActionKey] ?? 0) + 1, - }; - }, - initialAcc, - ); - - expect(actualActionsTypeCounter).toEqual({ - ...initialAcc, - ...expectedActionsTypeCounter, - }); -}; - describe.each(allWorkspaceBuilderTestCases)( 'Workspace migration builder $label actions test suite', ({ testCases }) => { @@ -114,7 +70,7 @@ describe.each(allWorkspaceBuilderTestCases)( it.each(eachTestingContextFilter(testCases))( '$title', - async ({ context: { input, expectedActionsTypeCounter } }) => { + async ({ context: { input } }) => { const { fromFlatObjectMetadataMaps, toFlatObjectMetadataMaps, @@ -127,22 +83,21 @@ describe.each(allWorkspaceBuilderTestCases)( buildOptions, fromFlatObjectMetadataMaps, toFlatObjectMetadataMaps, - workspaceId: '20202020-52cc-4c64-ad63-76c26fc3a1e1', }); expect(validateAndBuildResult.status).toBe('success'); if (validateAndBuildResult.status !== 'success') { throw new Error('Should never occur'); } - - expectedActionsTypeCounterChecker({ - expectedActionsTypeCounter, - workspaceMigration: validateAndBuildResult.workspaceMigration, - }); - const { actions } = validateAndBuildResult.workspaceMigration; - - expect(actions).toMatchSnapshot( - actions.map(extractRecordIdsAndDatesAsExpectAny), + expect(validateAndBuildResult.fieldsActions).toMatchSnapshot( + extractRecordIdsAndDatesAsExpectAny( + validateAndBuildResult.fieldsActions, + ), + ); + expect(validateAndBuildResult.objectActions).toMatchSnapshot( + extractRecordIdsAndDatesAsExpectAny( + validateAndBuildResult.objectActions, + ), ); }, ); diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service.ts index ef80d0ea56..3cd2fa5319 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service.ts @@ -16,12 +16,20 @@ import { type FailedFlatEntityValidation } from 'src/engine/workspace-manager/wo import { type WorkspaceMigrationV2BuilderOptions } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service'; import { type WorkspaceMigrationActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-action-common-v2'; +export type CreatedDeletedUpdatedActions< + TActions extends WorkspaceMigrationActionV2, +> = { + created: TActions[]; + deleted: TActions[]; + updated: TActions[]; +}; + export type SuccessfulEntityMigrationBuildResult< TActions extends WorkspaceMigrationActionV2, TFlatEntity extends FlatEntity, > = { status: 'success'; - actions: TActions[]; + actions: CreatedDeletedUpdatedActions; optimisticFlatEntityMaps: FlatEntityMaps; }; @@ -57,10 +65,7 @@ export type ValidateAndBuilActionsReturnType< TActions extends WorkspaceMigrationActionV2, > = { failed: FailedFlatEntityValidation[]; - created: TActions[]; - deleted: TActions[]; - updated: TActions[]; -}; +} & CreatedDeletedUpdatedActions; export type FlatEntityValidationArgs< TFlatEntity extends FlatEntity, @@ -219,11 +224,11 @@ export abstract class WorkspaceEntityMigrationBuilderV2Service< return { status: 'success', - actions: [ - ...validateAndBuildResult.deleted, - ...validateAndBuildResult.created, - ...validateAndBuildResult.updated, - ], + actions: { + created: validateAndBuildResult.created, + deleted: validateAndBuildResult.deleted, + updated: validateAndBuildResult.updated, + }, optimisticFlatEntityMaps, }; } diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service.ts index 9744b7cdd7..a8816fa8f2 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-migration-builder-v2.service.ts @@ -9,9 +9,10 @@ import { deletedCreatedUpdatedMatrixDispatcher } from 'src/engine/workspace-mana import { WorkspaceMigrationV2FieldActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/field/services/workspace-migration-v2-field-actions-builder.service'; import { WorkspaceMigrationV2ObjectActionsBuilderService } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/object/services/workspace-migration-v2-object-actions-builder.service'; import { FailedFlatEntityValidation } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/builders/types/failed-flat-entity-validation.type'; -import { WorkspaceMigrationV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-v2'; +import { CreatedDeletedUpdatedActions } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/services/workspace-entity-migration-builder-v2.service'; +import { WorkspaceMigrationFieldActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-field-action-v2'; +import { WorkspaceMigrationObjectActionV2 } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/types/workspace-migration-object-action-v2'; import { computeUpdatedObjectMetadataDeletedCreatedUpdatedFieldMatrix } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/utils/compute-updated-object-metadata-deleted-created-updated-field-matrix.util'; -import { getWorkspaceMigrationV2CreateIndexAction } from 'src/engine/workspace-manager/workspace-migration-v2/workspace-migration-builder-v2/utils/get-workspace-migration-v2-index-actions'; export type WorkspaceMigrationV2BuilderOptions = { inferDeletionFromMissingEntities: boolean; @@ -20,7 +21,8 @@ export type WorkspaceMigrationV2BuilderOptions = { export type SuccessfulWorkspaceMigrationBuildResult = { status: 'success'; - workspaceMigration: WorkspaceMigrationV2; + objectActions: CreatedDeletedUpdatedActions; + fieldsActions: CreatedDeletedUpdatedActions; optimisticFlatObjectMetadataMaps: FlatObjectMetadataMaps; }; @@ -31,7 +33,6 @@ export type FailedWorkspaceMigrationBuildResult = { }; export type WorkspaceMigrationBuildArgs = { - workspaceId: string; buildOptions: WorkspaceMigrationV2BuilderOptions; } & FromTo; // TODO deprecate this file @@ -45,11 +46,10 @@ export class WorkspaceMigrationBuilderV2Service { public async validateAndBuild({ fromFlatObjectMetadataMaps, toFlatObjectMetadataMaps, - workspaceId, buildOptions, }: WorkspaceMigrationBuildArgs): Promise< - | SuccessfulWorkspaceMigrationBuildResult | FailedWorkspaceMigrationBuildResult + | SuccessfulWorkspaceMigrationBuildResult > { const fromFlatObjectMetadatas = fromFlatObjectMetadataMapsToFlatObjectMetadatas( @@ -99,13 +99,6 @@ export class WorkspaceMigrationBuilderV2Service { }, ); - const createdObjectMetadataCreateIndexActions = - createdFlatObjectMetadatas.flatMap((objectMetadata) => - objectMetadata.flatIndexMetadatas.map( - getWorkspaceMigrationV2CreateIndexAction, - ), - ); - const allValidateAndBuildResultFailures = [ ...objectActionsValidateAndBuildResult.failed, ...fieldActionsValidateAndBuildResult.failed, @@ -122,17 +115,15 @@ export class WorkspaceMigrationBuilderV2Service { return { status: 'success', - workspaceMigration: { - workspaceId, - actions: [ - ...fieldActionsValidateAndBuildResult.deleted, // Should be handled separately from objects - ...objectActionsValidateAndBuildResult.deleted, - ...objectActionsValidateAndBuildResult.created, - ...objectActionsValidateAndBuildResult.updated, - ...fieldActionsValidateAndBuildResult.created, // Should be handled separately from objects - ...fieldActionsValidateAndBuildResult.updated, // Should be handled separately from objects - ...createdObjectMetadataCreateIndexActions, - ], + fieldsActions: { + created: fieldActionsValidateAndBuildResult.created, + deleted: fieldActionsValidateAndBuildResult.deleted, + updated: fieldActionsValidateAndBuildResult.updated, + }, + objectActions: { + created: objectActionsValidateAndBuildResult.created, + deleted: objectActionsValidateAndBuildResult.deleted, + updated: objectActionsValidateAndBuildResult.updated, }, optimisticFlatObjectMetadataMaps: fieldActionsValidateAndBuildResult.optimisticFlatObjectMetadataMaps,