Skip to content

The open alternative to Salesforce, designed for AI.

Fix referential_constraints health check (#4139)

Weikod5e88445210f
diff --git a/packages/twenty-server/src/workspace/workspace-health/services/database-structure.service.ts b/packages/twenty-server/src/workspace/workspace-health/services/database-structure.service.ts
index dc9c88fc027..0ce9aea71af 100644
--- a/packages/twenty-server/src/workspace/workspace-health/services/database-structure.service.ts
+++ b/packages/twenty-server/src/workspace/workspace-health/services/database-structure.service.ts
@@ -114,6 +114,7 @@ export class DatabaseStructureService {
LEFT JOIN
information_schema.referential_constraints AS rc
ON rc.constraint_name = fk.constraint_name
+ AND rc.constraint_schema = '${schemaName}'
WHERE
c.table_schema = '${schemaName}'
AND c.table_name = '${tableName}';