From 9aaed28dcf3b93d8833794e7c78d525d026b4795 Mon Sep 17 00:00:00 2001 From: Weiko Date: Tue, 7 Oct 2025 16:57:22 +0200 Subject: [PATCH] Fix app deletion missing cache invalidation (#14944) App deletion currently deletes all related entities through postgres cascade delete meaning we never run actual migrations ourself and never trigger cache invalidation (part of migration engine) --- .../core-modules/application/application.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/twenty-server/src/engine/core-modules/application/application.service.ts b/packages/twenty-server/src/engine/core-modules/application/application.service.ts index b3fece99f30..ca737d88899 100644 --- a/packages/twenty-server/src/engine/core-modules/application/application.service.ts +++ b/packages/twenty-server/src/engine/core-modules/application/application.service.ts @@ -1,17 +1,19 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; import { isDefined } from 'twenty-shared/utils'; +import { Repository } from 'typeorm'; import { ApplicationEntity } from 'src/engine/core-modules/application/application.entity'; import { PackageJson } from 'src/engine/core-modules/application/types/application.types'; +import { WorkspaceManyOrAllFlatEntityMapsCacheService } from 'src/engine/core-modules/common/services/workspace-many-or-all-flat-entity-maps-cache.service'; @Injectable() export class ApplicationService { constructor( @InjectRepository(ApplicationEntity) private readonly applicationRepository: Repository, + private readonly flatEntityMapsCacheService: WorkspaceManyOrAllFlatEntityMapsCacheService, ) {} async findById(id: string): Promise { @@ -86,5 +88,9 @@ export class ApplicationService { universalIdentifier, workspaceId, }); + + await this.flatEntityMapsCacheService.invalidateFlatEntityMaps({ + workspaceId, + }); } }