oncall-engine/engine/apps
Matias Bordese 20ec6f52bc
Add is_legacy column to handle webhook migration (#1813)
Legacy webhooks won't be editable at first. Keep data templates
compatibility.

Possible migration code:
```python
from apps.webhooks.models import Webhook
from apps.alerts.models import CustomButton, EscalationPolicy

custom_buttons = CustomButton.objects.all()
for cb in custom_buttons:
    webhook, _ = Webhook.objects.get_or_create(
        organization=cb.organization,
        team=cb.team,
        name=cb.name,
        is_legacy=True,
        defaults=dict(
            created_at=cb.created_at,
            url=cb.webhook,
            username=cb.user,
            password=cb.password,
            authorization_header=cb.authorization_header,
            trigger_type=Webhook.TRIGGER_ESCALATION_STEP,
            forward_all=cb.forward_whole_payload,
            data=cb.data,
        )
    )
    # migrate related escalation policies
    policies = EscalationPolicy.objects.filter(
        step=EscalationPolicy.STEP_TRIGGER_CUSTOM_BUTTON,
        custom_button_trigger=cb,
    ).update(
        step=EscalationPolicy.STEP_TRIGGER_CUSTOM_WEBHOOK,
        custom_webhook=webhook,
    )

```
2023-04-25 11:22:56 -03:00
..
alerts Reuse web templates in other templates (#1786) 2023-04-24 07:44:39 +00:00
api Add is_legacy column to handle webhook migration (#1813) 2023-04-25 11:22:56 -03:00
api_for_grafana_incident Include alert details in Grafana Incident alert-group endpoint (#1280) 2023-02-03 13:43:21 +00:00
auth_token Change Organization Deleted/Moved Precedence (#1402) 2023-02-24 11:45:21 +00:00
base Fix documentation links (#1766) 2023-04-19 10:12:16 +01:00
email Inbound email integration (#837) 2023-03-16 13:59:21 +08:00
grafana_plugin Check stack cluster for insight_logs (#1469) 2023-03-09 06:30:54 +00:00
heartbeat Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
integrations Limit number of alertmanager alerts in alert group to autoresolve (#1779) 2023-04-24 05:38:21 +00:00
mobile_app Update apns payload with corrected critical field (#1646) 2023-03-28 10:57:40 +00:00
oss_installation Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
public_api Update shift API to use a default for interval when missing (#1810) 2023-04-21 19:13:09 +00:00
schedules Add final schedule export refresh note (#1807) 2023-04-24 12:56:37 -03:00
slack Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
social_auth Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
telegram Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
twilioapp Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
user_management Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
webhooks Add is_legacy column to handle webhook migration (#1813) 2023-04-25 11:22:56 -03:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00