UPDATE modules
SET
    deleted_at = CURRENT_TIMESTAMP,
    updated_at = CURRENT_TIMESTAMP
WHERE slug = 'module-test'
  AND deleted_at IS NULL;

DELETE er
FROM entity_relations er
JOIN modules m ON m.id = er.source_id
WHERE er.source_type = 'module'
  AND m.slug = 'module-test';

DELETE er
FROM entity_relations er
JOIN modules m ON m.id = er.target_id
WHERE er.target_type = 'module'
  AND m.slug = 'module-test';
