add createMany fields to fieldMetadataService to batch field creation (#9957)
## Context Not exposed in the API yet, this new method allows us to reduce the time to create multiple fields at once, mostly during seeding. This allows us to batch transactions and avoid recomputing the cache everytime. With this change, we recompute the cache 7 times instead of 35 during seeding. We could do the same for objects.
This commit is contained in:
@ -37,13 +37,13 @@ export class SeederService {
|
||||
throw new Error("Object metadata couldn't be created");
|
||||
}
|
||||
|
||||
for (const fieldMetadataSeed of objectMetadataSeed.fields) {
|
||||
await this.fieldMetadataService.createOne({
|
||||
await this.fieldMetadataService.createMany(
|
||||
objectMetadataSeed.fields.map((fieldMetadataSeed) => ({
|
||||
...fieldMetadataSeed,
|
||||
objectMetadataId: createdObjectMetadata.id,
|
||||
workspaceId,
|
||||
});
|
||||
}
|
||||
})),
|
||||
);
|
||||
|
||||
const objectMetadataAfterFieldCreation =
|
||||
await this.objectMetadataService.findOneWithinWorkspace(workspaceId, {
|
||||
|
||||
Reference in New Issue
Block a user