Create record position field (#3739)

* Create record field on non syst standard objects + on custom objects

* Create workspace migration

* Fix naming and add seed

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-02-01 16:56:38 +01:00
committed by GitHub
parent 9799326533
commit 7b2b70e479
7 changed files with 69 additions and 0 deletions

View File

@ -291,6 +291,22 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
workspaceId: objectMetadataInput.workspaceId,
defaultValue: { type: 'now' },
},
{
type: FieldMetadataType.NUMBER,
name: 'recordPosition',
label: 'Record position',
targetColumnMap: {
value: 'recordPosition',
},
icon: 'IconHierarchy2',
description: 'Record position',
isNullable: true,
isActive: true,
isCustom: false,
isSystem: true,
workspaceId: objectMetadataInput.workspaceId,
defaultValue: null,
},
],
});
@ -375,6 +391,18 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
},
],
},
{
name: computeObjectTargetTable(createdObjectMetadata),
action: 'alter',
columns: [
{
action: WorkspaceMigrationColumnActionType.CREATE,
columnName: 'recordPosition',
columnType: 'float',
isNullable: true,
} satisfies WorkspaceMigrationColumnCreate,
],
} satisfies WorkspaceMigrationTableAction,
// This is temporary until we implement mainIdentifier
{
name: computeObjectTargetTable(createdObjectMetadata),