Skip to content
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

chore(aci): add unique together constraint on DetectorWorkflow #87464

Merged
merged 3 commits into from
Mar 20, 2025

Conversation

ameliahsu
Copy link
Member

each detector-workflow pair should only have 1 connection

@ameliahsu ameliahsu requested review from a team as code owners March 19, 2025 23:00
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 19, 2025
@cathteng
Copy link
Member

should we add this constraint for all the workflow engine lookup tables?

Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/workflow_engine/migrations/0038_add_detector_workflow_unique_together.py ()

--
-- Alter unique_together for detectorworkflow (1 constraint(s))
--
CREATE UNIQUE INDEX CONCURRENTLY "workflow_engine_detector_detector_id_workflow_id_e900662b_uniq" ON "workflow_engine_detectorworkflow" ("detector_id", "workflow_id");
ALTER TABLE "workflow_engine_detectorworkflow" ADD CONSTRAINT "workflow_engine_detector_detector_id_workflow_id_e900662b_uniq" UNIQUE USING INDEX "workflow_engine_detector_detector_id_workflow_id_e900662b_uniq";

@saponifi3d
Copy link
Contributor

@cathteng - agree, but we should probably enumerate a list and just knock them all out in a separate PR -- this can at least unblock @ameliahsu on the API she's building.

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - i think you might need a DB migration +1 as well though.

@ameliahsu ameliahsu merged commit 38d363b into master Mar 20, 2025
48 checks passed
@ameliahsu ameliahsu deleted the mia/aci/detector-workflow/unique branch March 20, 2025 16:51
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.

None yet

4 participants