AI-generated content
Untrusted Database Constraints
Checks that all Umbraco foreign key and check constraints on SQL Server are trusted.
What is an "untrusted" constraint?
How to fix this health check
1. Identify the untrusted constraints
SELECT 'Foreign key' AS ConstraintType, s.name AS SchemaName,
OBJECT_NAME(fk.parent_object_id) AS TableName, fk.name AS ConstraintName
FROM sys.foreign_keys fk
INNER JOIN sys.schemas s ON fk.schema_id = s.schema_id
WHERE fk.is_not_trusted = 1
AND (OBJECT_NAME(fk.parent_object_id) LIKE 'umbraco%' OR OBJECT_NAME(fk.parent_object_id) LIKE 'cms%')
UNION ALL
SELECT 'Check constraint', s.name,
OBJECT_NAME(cc.parent_object_id), cc.name
FROM sys.check_constraints cc
INNER JOIN sys.schemas s ON cc.schema_id = s.schema_id
WHERE cc.is_not_trusted = 1
AND (OBJECT_NAME(cc.parent_object_id) LIKE 'umbraco%' OR OBJECT_NAME(cc.parent_object_id) LIKE 'cms%');2. Try to re-trust the constraint
3. Find the offending rows
4. Remove the offending rows
5. Re-trust the constraint
6. Re-run the health check
Check constraints
Last updated
Was this helpful?