twenty icon indicating copy to clipboard operation
twenty copied to clipboard

[Flexible-Schema] I can add an Index decorator to BaseObjectMetadata classes

Open Weiko opened this issue 1 year ago • 0 comments

Scope & Context

Some queries are quite expensive and we currently have no way to create an index for our standard objects except for FK. Ideally we should be able to add an [at]Index decorator that will contain the columns we want to index for composite indexes or an [at]Index decorator for each field if we want to index a specific column. This should be similar to the typeorm way.

  @FieldMetadata({
    type: FieldMetadataType.TEXT,
    label: 'Handle',
    description: 'Handle',
    icon: 'IconAt',
  })
  @Index()
  handle: string;
@IsSystem()
@Index(['handle', 'visibility'])
export class MessageChannelObjectMetadata extends BaseObjectMetadata {

Note that for composite index, the order is important.

Technical inputs

TBD

Weiko avatar Jan 30 '24 17:01 Weiko