-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(workflow_engine): Updates to the data models #80710
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #80710 +/- ##
=======================================
Coverage 78.42% 78.42%
=======================================
Files 7211 7212 +1
Lines 319719 319735 +16
Branches 44005 44005
=======================================
+ Hits 250729 250748 +19
+ Misses 62603 62601 -2
+ Partials 6387 6386 -1 |
6feb564
to
b24e4cb
Compare
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
51a40df
to
17678ff
Compare
fac967d
to
9dda872
Compare
This PR has a migration; here is the generated SQL for --
-- Add field comparison_delta to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "comparison_delta" integer NULL;
--
-- Add field description to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "description" text NULL;
--
-- Custom state/database change combination
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "enabled" boolean NOT NULL DEFAULT true;
--
-- Add field project to detector
--
ALTER TABLE "workflow_engine_detector" ADD COLUMN "project_id" bigint NULL;
--
-- Add field created_by to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "created_by" bigint NULL;
--
-- Custom state/database change combination
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "enabled" boolean NOT NULL DEFAULT true;
--
-- Add field environment_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "environment_id" integer NULL CHECK ("environment_id" >= 0);
--
-- Custom state/database change combination
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "frequency" integer not null default 30;
--
-- Add field owner_team to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_team_id" bigint NULL;
--
-- Add field owner_user_id to workflow
--
ALTER TABLE "workflow_engine_workflow" ADD COLUMN "owner_user_id" bigint NULL;
--
-- Alter field required on action
--
ALTER TABLE "workflow_engine_action" ALTER COLUMN "required" DROP NOT NULL;
--
-- Alter field organization on detector
--
SET CONSTRAINTS "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" IMMEDIATE; ALTER TABLE "workflow_engine_detector" DROP CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
ALTER TABLE "workflow_engine_detector" ALTER COLUMN "organization_id" DROP NOT NULL;
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or" FOREIGN KEY ("organization_id") REFERENCES "sentry_organization" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_organization_id_411c3ae7_fk_sentry_or";
ALTER TABLE "workflow_engine_detector" ADD CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr" FOREIGN KEY ("project_id") REFERENCES "sentry_project" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_detector" VALIDATE CONSTRAINT "workflow_engine_dete_project_id_275be9df_fk_sentry_pr";
CREATE INDEX CONCURRENTLY "workflow_engine_detector_project_id_275be9df" ON "workflow_engine_detector" ("project_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_created_by_a98158f7" ON "workflow_engine_workflow" ("created_by");
ALTER TABLE "workflow_engine_workflow" ADD CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te" FOREIGN KEY ("owner_team_id") REFERENCES "sentry_team" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "workflow_engine_workflow" VALIDATE CONSTRAINT "workflow_engine_work_owner_team_id_c401e7b8_fk_sentry_te";
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_team_id_c401e7b8" ON "workflow_engine_workflow" ("owner_team_id");
CREATE INDEX CONCURRENTLY "workflow_engine_workflow_owner_user_id_1ef7b270" ON "workflow_engine_workflow" ("owner_user_id"); |
49b13e6
to
2cd8967
Compare
4196caf
to
aaca8de
Compare
aaca8de
to
9790019
Compare
src/sentry/workflow_engine/migrations/0013_aci_model_updates_from_milestones.py
Outdated
Show resolved
Hide resolved
@@ -21,17 +21,29 @@ | |||
|
|||
@region_silo_model | |||
class Detector(DefaultFieldsModel, OwnerModel): | |||
__relocation_scope__ = RelocationScope.Organization | |||
__relocation_scope__ = RelocationScope.Excluded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why'd we move to excluded instead of project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see a RelocationScope.Project
- i was following the pattern i saw in other models that were related to the project.
can you link to an example and i'll follow that pattern? (thanks!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think we're just meant to use Organization
actually like
sentry/src/sentry/models/options/project_option.py
Lines 166 to 175 in 1c0cb14
@region_silo_model | |
class ProjectOption(Model): | |
""" | |
Project options apply only to an instance of a project. | |
Options which are specific to a plugin should namespace | |
their key. e.g. key='myplugin:optname' | |
""" | |
__relocation_scope__ = RelocationScope.Organization |
src/sentry/workflow_engine/migrations/0013_aci_model_updates_from_milestones.py
Outdated
Show resolved
Hide resolved
Bundle ReportBundle size has no change ✅ |
946517f
to
7f4c7b2
Compare
030dd2a
to
e1419e0
Compare
…ject - removing the association with the organization since we can get that through the
- Add comparison_delta to the detector, this is used for comparison alerts. - Add description for slack notifications
…roject is deleted, cascade
…llowing the DB migration docs
e1419e0
to
54245f9
Compare
Description
As we continue to spec out the migrations for issue alerts / metric alerts, we found a few more data model changes.