Backfill position when not input (#5696)
- refactor record position factory and record position query factory - override position if not present during createMany To avoid overriding the same positions for all data in createMany, the logic is: - if inserted last, use last position + arg index + 1 - if inserted first, use first position - arg index - 1
This commit is contained in:
@ -31,16 +31,19 @@ export class RecordPositionBackfillService {
|
||||
const dataSourceSchema =
|
||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
||||
|
||||
const query = await this.recordPositionQueryFactory.create(
|
||||
RecordPositionQueryType.UPDATE,
|
||||
position,
|
||||
const [query, params] = await this.recordPositionQueryFactory.create(
|
||||
{
|
||||
recordPositionQueryType: RecordPositionQueryType.UPDATE_POSITION,
|
||||
recordId,
|
||||
positionValue: position,
|
||||
},
|
||||
objectMetadata as ObjectMetadataInterface,
|
||||
dataSourceSchema,
|
||||
);
|
||||
|
||||
this.workspaceDataSourceService.executeRawQuery(
|
||||
query,
|
||||
[position, recordId],
|
||||
params,
|
||||
workspaceId,
|
||||
undefined,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user