Add deletedAt to foreignKey indexes (#7133)
We had to remove soft-deletion on default filters due to the missing indexes. We now generate composite indexes with the foreign key containing the deletedAt column as well which should improve performances
This commit is contained in:
@ -79,7 +79,8 @@ export class GraphqlQueryFindManyResolverService {
|
||||
args.orderBy ?? [],
|
||||
isForwardPagination,
|
||||
);
|
||||
const where = graphqlQueryParser.parseFilter(args.filter ?? ({} as Filter));
|
||||
const { parsedFilters: where, withDeleted } =
|
||||
graphqlQueryParser.parseFilter(args.filter ?? ({} as Filter));
|
||||
|
||||
const cursor = this.getCursor(args);
|
||||
const limit = args.first ?? args.last ?? QUERY_MAX_RECORDS;
|
||||
@ -92,10 +93,11 @@ export class GraphqlQueryFindManyResolverService {
|
||||
order,
|
||||
select,
|
||||
take: limit + 1,
|
||||
withDeleted,
|
||||
};
|
||||
|
||||
const totalCount = isDefined(selectedFields.totalCount)
|
||||
? await repository.count({ where })
|
||||
? await repository.count({ where, withDeleted })
|
||||
: 0;
|
||||
|
||||
if (cursor) {
|
||||
|
||||
@ -63,11 +63,13 @@ export class GraphqlQueryFindOneResolverService {
|
||||
objectMetadataItem,
|
||||
selectedFields,
|
||||
);
|
||||
const where = graphqlQueryParser.parseFilter(args.filter ?? ({} as Filter));
|
||||
const { parsedFilters: where, withDeleted } =
|
||||
graphqlQueryParser.parseFilter(args.filter ?? ({} as Filter));
|
||||
|
||||
const objectRecord = (await repository.findOne({
|
||||
where,
|
||||
select,
|
||||
withDeleted,
|
||||
})) as ObjectRecord;
|
||||
|
||||
const limit = QUERY_MAX_RECORDS;
|
||||
|
||||
Reference in New Issue
Block a user