Skip to content

db: update webhookpayload #93855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

joseph-sentry
Copy link
Contributor

I add the destination_type field, make the region name nullable and add a constraint so if the destination_type == SENTRY_REGION then the region_name must be set to a value.

These are the equivalent database changes for a following change that will implement webhook forwarding to Codecov using the hybrid cloud webhook forwarding system. Webhooks meant to be forwarded to Codecov will have differing logic that runs to forward them which is why I'm adding the destination_type field so we can distinguish them.

I add the destination_type field, make the region name nullable and add a
constraint so if the destination_type == SENTRY_REGION then the region_name must
be set to a value.

These are the equivalent database changes for a following change that will
implement webhook forwarding to Codecov using the hybrid cloud webhook
forwarding system. Webhooks meant to be forwarded to Codecov will have differing
logic that runs to forward them which is why I'm adding the destination_type
field so we can distinguish them.
@joseph-sentry joseph-sentry requested a review from a team as a code owner June 18, 2025 20:18
@joseph-sentry joseph-sentry requested a review from wedamija June 18, 2025 20:19
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 18, 2025
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/hybridcloud/migrations/0022_webhook_payload_update.py

for 0022_webhook_payload_update in hybridcloud

--
-- Add field destination_type to webhookpayload
--
ALTER TABLE "hybridcloud_webhookpayload" ADD COLUMN "destination_type" varchar DEFAULT 'sentry_region' NOT NULL;
--
-- Alter field region_name on webhookpayload
--
ALTER TABLE "hybridcloud_webhookpayload" ALTER COLUMN "region_name" DROP NOT NULL;
--
-- Create constraint webhookpayload_region_name_not_null on model webhookpayload
--
ALTER TABLE "hybridcloud_webhookpayload" ADD CONSTRAINT "webhookpayload_region_name_not_null" CHECK (("destination_type" = 'sentry_region' AND "region_name" IS NOT NULL)) NOT VALID;
ALTER TABLE "hybridcloud_webhookpayload" VALIDATE CONSTRAINT "webhookpayload_region_name_not_null";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant