## Why After the changes on relations, index on relations were skipped by the syncmetadata service, so no more migrations were generated for relation fields. We wanted to fix this. ## Test This PR adds unit tests for the `createIndexMigration` utility in the workspace migration builder. The tests cover: - Creating index migrations for simple fields (e.g., text fields) - Creating index migrations for relation fields (ensuring correct column naming, e.g., `authorId` for the `author` objectmetadataname) ## Excluded The delete index on relation does not need the column names so i don't think i needed to work on this method. I might be wrong. ## Checklist - [x] Added/updated unit tests for index migration creation - [x] Verified correct handling of simple and relation fields - [x] Ensured all tests pass --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Charles Bochet <charles@twenty.com>
10 lines
398 B
TypeScript
10 lines
398 B
TypeScript
import { ObjectMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/object-metadata.interface';
|
|
|
|
import { computeTableName } from './compute-table-name.util';
|
|
|
|
export const computeObjectTargetTable = (
|
|
objectMetadata: Pick<ObjectMetadataInterface, 'nameSingular' | 'isCustom'>,
|
|
) => {
|
|
return computeTableName(objectMetadata.nameSingular, objectMetadata.isCustom);
|
|
};
|