-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1525 from bersace/env
Query notify contacts using envs
- Loading branch information
Showing
1 changed file
with
6 additions
and
9 deletions.
There are no files selected for viewing
15 changes: 6 additions & 9 deletions
15
ui/temboardui/model/queries/instance-select-email-and-phone-for-notify.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
SELECT | ||
array_agg(DISTINCT r.role_email) FILTER (WHERE r.role_email IS NOT NULL AND r.role_email <> '') AS emails, | ||
array_agg(DISTINCT r.role_phone) FILTER (WHERE r.role_phone IS NOT NULL AND r.role_phone <> '') AS phones | ||
FROM application.instance_groups AS ixg | ||
JOIN application.access_role_instance AS ari | ||
ON ari.instance_group_name = ixg.group_name AND ari.instance_group_kind = ixg.group_kind | ||
JOIN application.role_groups AS rxg | ||
ON rxg.group_name = ari.role_group_name AND rxg.group_kind = ari.role_group_kind | ||
JOIN application.roles AS r | ||
ON r.role_name = rxg.role_name | ||
WHERE ixg.agent_address = :agent_address AND ixg.agent_port = :agent_port | ||
AND r.is_active; | ||
FROM application.instances AS i | ||
JOIN application.environments AS e ON i.environment_id = e.id | ||
JOIN application.memberships AS m ON e.dba_group_id = m.group_id | ||
JOIN application.roles AS r ON m.role_name = r.role_name | ||
WHERE i.agent_address = :agent_address AND i.agent_port = :agent_port | ||
AND r.is_active AND i.notify; |