Index v2 side effects (#14567)
# Introduction Honestly this implem is a mess, discussing a potential side effect handler with @weiko before the build and run that would handle each side effect per entity and operation Handling: - [ ] unique index is generated when a field is updated with the `isUnique` - [x] an index is generated when a relation is created - [x] search vector index creation on custom object creation - [x] renaming a field metadata or an object should re-create all related indexes which are composed by their namings - [x] delete object should remove any related indexes - [x] delete field should update related indexes ( if index ends up empty it should be removed ) - [ ] on object renaming that contains morph fields -> triggers update field -> trigger index recompute - [x] on update name renaming should recompute all related indexes ## TODO - [x] Integration testing - [ ] Refactor the index maps cache to be storing a `idsByObjectMetadataId` - [x] Refactor deterministic name to use order sorting - [x] Remove flat index from flat object ## What's next Will handle morph indexes in a new dedicated PR for the moment will stick to this Same for the cache improvement and uniqueness
This commit is contained in:
+353
-313
@@ -83,12 +83,189 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
|
||||
exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test suite Success cases should create morph relation field metadata with valid input on rocket object to pet object 1`] = `
|
||||
{
|
||||
"result": [
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
"result": {
|
||||
"flatFieldMetadatas": [
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": null,
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": null,
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"icon": "IconCat",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Pets",
|
||||
"labelSingular": "Pet",
|
||||
"namePlural": "pets",
|
||||
"nameSingular": "pet",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldPets",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Rockets",
|
||||
"labelSingular": "Rocket",
|
||||
"namePlural": "rockets",
|
||||
"nameSingular": "rocket",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconPet",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "Pet",
|
||||
"morphId": null,
|
||||
"name": "pet",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"joinColumnName": "petId",
|
||||
"onDelete": "SET_NULL",
|
||||
"relationType": "MANY_TO_ONE",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": null,
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"icon": "IconCat",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Pets",
|
||||
"labelSingular": "Pet",
|
||||
"namePlural": "pets",
|
||||
"nameSingular": "pet",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldPets",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
@@ -102,7 +279,6 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"description": null,
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconCat",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
@@ -158,7 +334,6 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
@@ -211,95 +386,154 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": null,
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconCat",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Pets",
|
||||
"labelSingular": "Pet",
|
||||
"namePlural": "pets",
|
||||
"nameSingular": "pet",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldPets",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": null,
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": null,
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A company",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"icon": "IconBuildingSkyscraper",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": false,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Companies",
|
||||
"labelSingular": "Company",
|
||||
"namePlural": "companies",
|
||||
"nameSingular": "company",
|
||||
"shortcut": "C",
|
||||
"standardId": Any<String>,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldCompanies",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Rockets",
|
||||
"labelSingular": "Rocket",
|
||||
"namePlural": "rockets",
|
||||
"nameSingular": "rocket",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconBuilding",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "Company",
|
||||
"morphId": null,
|
||||
"name": "company",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"joinColumnName": "companyId",
|
||||
"onDelete": "SET_NULL",
|
||||
"relationType": "MANY_TO_ONE",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": null,
|
||||
"description": "A company",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconCat",
|
||||
"icon": "IconBuildingSkyscraper",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isCustom": false,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Pets",
|
||||
"labelSingular": "Pet",
|
||||
"namePlural": "pets",
|
||||
"nameSingular": "pet",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"labelPlural": "Companies",
|
||||
"labelSingular": "Company",
|
||||
"namePlural": "companies",
|
||||
"nameSingular": "company",
|
||||
"shortcut": "C",
|
||||
"standardId": Any<String>,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
@@ -317,7 +551,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldPets",
|
||||
"name": "newFieldCompanies",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
@@ -332,69 +566,7 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Rockets",
|
||||
"labelSingular": "Rocket",
|
||||
"namePlural": "rockets",
|
||||
"nameSingular": "rocket",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconPet",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "Pet",
|
||||
"morphId": null,
|
||||
"name": "pet",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"joinColumnName": "petId",
|
||||
"onDelete": "SET_NULL",
|
||||
"relationType": "MANY_TO_ONE",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
@@ -408,7 +580,6 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"description": "A company",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconBuildingSkyscraper",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
@@ -464,7 +635,6 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
@@ -517,186 +687,56 @@ exports[`fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test su
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A company",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconBuildingSkyscraper",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": false,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Companies",
|
||||
"labelSingular": "Company",
|
||||
"namePlural": "companies",
|
||||
"nameSingular": "company",
|
||||
"shortcut": "C",
|
||||
"standardId": Any<String>,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldCompanies",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": null,
|
||||
"flatRelationTargetFieldMetadata": {
|
||||
],
|
||||
"indexMetadatas": [
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"defaultValue": null,
|
||||
"description": "new field description",
|
||||
"flatRelationTargetFieldMetadata": null,
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A company",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconBuildingSkyscraper",
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"isCustom": false,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Companies",
|
||||
"labelSingular": "Company",
|
||||
"namePlural": "companies",
|
||||
"nameSingular": "company",
|
||||
"shortcut": "C",
|
||||
"standardId": Any<String>,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconRelationOneToMany",
|
||||
"flatIndexFieldMetadatas": [
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"fieldMetadataId": Any<String>,
|
||||
"id": Any<String>,
|
||||
"indexMetadataId": Any<String>,
|
||||
"order": 0,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
},
|
||||
],
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"indexType": "BTREE",
|
||||
"indexWhereClause": null,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "newFieldLabel",
|
||||
"morphId": Any<String>,
|
||||
"name": "newFieldCompanies",
|
||||
"isUnique": false,
|
||||
"name": "IDX_f687e4e4252800dddd8e5518362",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"relationType": "ONE_TO_MANY",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "MORPH_RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"flatRelationTargetObjectMetadata": {
|
||||
"createdAt": Any<String>,
|
||||
"description": "A rocket",
|
||||
"duplicateCriteria": null,
|
||||
"flatFieldMetadatas": [],
|
||||
"flatIndexMetadatas": [],
|
||||
"icon": "IconRocket",
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"flatIndexFieldMetadatas": [
|
||||
{
|
||||
"createdAt": Any<ClockDate>,
|
||||
"fieldMetadataId": Any<String>,
|
||||
"id": Any<String>,
|
||||
"indexMetadataId": Any<String>,
|
||||
"order": 0,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
},
|
||||
],
|
||||
"id": Any<String>,
|
||||
"imageIdentifierFieldMetadataId": null,
|
||||
"isActive": true,
|
||||
"isAuditLogged": true,
|
||||
"indexType": "BTREE",
|
||||
"indexWhereClause": null,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isRemote": false,
|
||||
"isSearchable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"labelIdentifierFieldMetadataId": Any<String>,
|
||||
"labelPlural": "Rockets",
|
||||
"labelSingular": "Rocket",
|
||||
"namePlural": "rockets",
|
||||
"nameSingular": "rocket",
|
||||
"shortcut": null,
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"targetTableName": "DEPRECATED",
|
||||
"isUnique": false,
|
||||
"name": "IDX_cb15d901e889e25d0a9acecb595",
|
||||
"objectMetadataId": Any<String>,
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
"icon": "IconBuilding",
|
||||
"id": Any<String>,
|
||||
"isActive": true,
|
||||
"isCustom": true,
|
||||
"isLabelSyncedWithName": false,
|
||||
"isNullable": true,
|
||||
"isSystem": false,
|
||||
"isUIReadOnly": false,
|
||||
"isUnique": null,
|
||||
"label": "Company",
|
||||
"morphId": null,
|
||||
"name": "company",
|
||||
"objectMetadataId": Any<String>,
|
||||
"options": null,
|
||||
"relationTargetFieldMetadataId": Any<String>,
|
||||
"relationTargetObjectMetadataId": Any<String>,
|
||||
"settings": {
|
||||
"joinColumnName": "companyId",
|
||||
"onDelete": "SET_NULL",
|
||||
"relationType": "MANY_TO_ONE",
|
||||
},
|
||||
"standardId": null,
|
||||
"standardOverrides": null,
|
||||
"type": "RELATION",
|
||||
"universalIdentifier": Any<String>,
|
||||
"updatedAt": Any<ClockDate>,
|
||||
"workspaceId": Any<String>,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
"status": "success",
|
||||
}
|
||||
`;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ describe('fromCreateFieldInputToFlatFieldMetadatasToCreate MORPH_RELATION test s
|
||||
if (result.status !== 'success') {
|
||||
throw new Error('Should never occur, typecheck');
|
||||
}
|
||||
expect(result.result.length).toBe(
|
||||
expect(result.result.flatFieldMetadatas.length).toBe(
|
||||
input.rawCreateFieldInput.morphRelationsCreationPayload.length * 2,
|
||||
);
|
||||
expect(result).toMatchSnapshot(
|
||||
|
||||
Reference in New Issue
Block a user