-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(consumer or provider webhooks): allow a webhook to be defined fo…
…r either a consumer OR provider
- Loading branch information
Showing
15 changed files
with
423 additions
and
116 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
db/migrations/20180113_make_webhook_pacticipant_ids_optional.rb
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Sequel.migration do | ||
up do | ||
alter_table(:webhooks) do | ||
set_column_allow_null(:consumer_id) | ||
set_column_allow_null(:provider_id) | ||
end | ||
|
||
alter_table(:triggered_webhooks) do | ||
set_column_allow_null(:consumer_id) | ||
set_column_allow_null(:provider_id) | ||
end | ||
|
||
create_or_replace_view(:latest_triggered_webhooks, | ||
"select tw.* | ||
from triggered_webhooks tw | ||
inner join latest_triggered_webhook_ids ltwi | ||
on tw.consumer_id = ltwi.consumer_id | ||
and tw.provider_id = ltwi.provider_id | ||
and tw.webhook_uuid = ltwi.webhook_uuid | ||
and tw.created_at = ltwi.latest_triggered_webhook_created_at | ||
union | ||
select tw.* | ||
from triggered_webhooks tw | ||
inner join latest_triggered_webhook_ids ltwi | ||
on tw.consumer_id = ltwi.consumer_id | ||
and tw.webhook_uuid = ltwi.webhook_uuid | ||
and tw.created_at = ltwi.latest_triggered_webhook_created_at | ||
where tw.provider_id is null | ||
and ltwi.provider_id is null | ||
union | ||
select tw.* | ||
from triggered_webhooks tw | ||
inner join latest_triggered_webhook_ids ltwi | ||
on tw.provider_id = ltwi.provider_id | ||
and tw.webhook_uuid = ltwi.webhook_uuid | ||
and tw.created_at = ltwi.latest_triggered_webhook_created_at | ||
where tw.consumer_id is null | ||
and ltwi.consumer_id is null" | ||
) | ||
end | ||
|
||
down do | ||
end | ||
end |
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
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
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
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
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
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
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
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
Oops, something went wrong.