2025-08-29 17:28:29 +02:00
|
|
|
-- Add "Data Product Domain Validation" rule to existing entityRulesSettings configuration
|
|
|
|
UPDATE openmetadata_settings
|
|
|
|
SET json = jsonb_set(
|
|
|
|
json,
|
|
|
|
'{entitySemantics}',
|
|
|
|
(json->'entitySemantics') || jsonb_build_object(
|
|
|
|
'name', 'Data Product Domain Validation',
|
|
|
|
'description', 'Validates that Data Products assigned to an entity match the entity''s domains.',
|
|
|
|
'rule', '{"validateDataProductDomainMatch":[{"var":"dataProducts"},{"var":"domains"}]}',
|
|
|
|
'enabled', true,
|
|
|
|
'provider', 'system'
|
|
|
|
)::jsonb,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
WHERE configtype = 'entityRulesSettings'
|
|
|
|
AND json->'entitySemantics' IS NOT NULL
|
|
|
|
AND NOT EXISTS (
|
|
|
|
SELECT 1
|
|
|
|
FROM jsonb_array_elements(json->'entitySemantics') AS rule
|
|
|
|
WHERE rule->>'name' = 'Data Product Domain Validation'
|
2025-09-11 15:14:38 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
-- Add generated column for customUnitOfMeasurement
|
|
|
|
ALTER TABLE metric_entity
|
|
|
|
ADD COLUMN customUnitOfMeasurement VARCHAR(256)
|
|
|
|
GENERATED ALWAYS AS ((json->>'customUnitOfMeasurement')::VARCHAR(256)) STORED;
|
|
|
|
-- Add index on the column
|
2025-09-16 15:16:06 +05:30
|
|
|
CREATE INDEX idx_metric_custom_unit ON metric_entity(customUnitOfMeasurement);
|
|
|
|
|
|
|
|
-- Fetch updated searchSettings
|
|
|
|
DELETE FROM openmetadata_settings WHERE configType = 'searchSettings';
|