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

feat(team-workflow): Add team to GroupSubscription #55879

Merged
merged 12 commits into from
Sep 12, 2023

Conversation

roggenkemper
Copy link
Member

this pr adds back the addition of team as a field on GroupSubscription (originally from #55805 , removed in #55870) .

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 7, 2023
@github-actions

This comment was marked as outdated.

@roggenkemper
Copy link
Member Author

don't merge until ops has run the migration

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #55879 (2a3b4d7) into master (ecf984b) will decrease coverage by 1.94%.
Report is 7 commits behind head on master.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #55879      +/-   ##
==========================================
- Coverage   79.98%   78.05%   -1.94%     
==========================================
  Files        5061     5063       +2     
  Lines      217762   217846      +84     
  Branches    36869    36879      +10     
==========================================
- Hits       174176   170032    -4144     
- Misses      38238    42521    +4283     
+ Partials     5348     5293      -55     
Files Changed Coverage
static/app/views/alerts/rules/issue/index.tsx ø
src/sentry/models/groupsubscription.py 100.00%

@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

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

--
-- Add field team to groupsubscription
--
ALTER TABLE "sentry_groupsubscription" ADD COLUMN "team_id" bigint NULL;
--
-- Custom state/database change combination
--

                    ALTER TABLE "sentry_groupsubscription" ALTER COLUMN "user_id" DROP NOT NULL;
                    ;
--
-- Alter unique_together for groupsubscription (2 constraint(s))
--
CREATE UNIQUE INDEX CONCURRENTLY "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq" ON "sentry_groupsubscription" ("group_id", "team_id");
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq" UNIQUE USING INDEX "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq";
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "sentry_groupsubscription_team_id_255af5da_fk_sentry_team_id" FOREIGN KEY ("team_id") REFERENCES "sentry_team" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_groupsubscription" VALIDATE CONSTRAINT "sentry_groupsubscription_team_id_255af5da_fk_sentry_team_id";
CREATE INDEX CONCURRENTLY "sentry_groupsubscription_team_id_255af5da" ON "sentry_groupsubscription" ("team_id");
--
-- Create constraint subscription_team_or_user_check on model groupsubscription
--
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "subscription_team_or_user_check" CHECK ((("team_id" IS NOT NULL AND "user_id" IS NULL) OR ("team_id" IS NULL AND "user_id" IS NOT NULL))) NOT VALID;
ALTER TABLE "sentry_groupsubscription" VALIDATE CONSTRAINT "subscription_team_or_user_check";

Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

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

Migration looks good to me. We'll need to wait for schema changes to be applied in saas before merging this though.

@github-actions
Copy link
Contributor

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

--
-- Add field team to groupsubscription
--
ALTER TABLE "sentry_groupsubscription" ADD COLUMN "team_id" bigint NULL;
--
-- Custom state/database change combination
--

                    ALTER TABLE "sentry_groupsubscription" ALTER COLUMN "user_id" DROP NOT NULL;
                    ;
--
-- Alter unique_together for groupsubscription (2 constraint(s))
--
CREATE UNIQUE INDEX CONCURRENTLY "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq" ON "sentry_groupsubscription" ("group_id", "team_id");
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq" UNIQUE USING INDEX "sentry_groupsubscription_group_id_team_id_ba7c937c_uniq";
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "sentry_groupsubscription_team_id_255af5da_fk_sentry_team_id" FOREIGN KEY ("team_id") REFERENCES "sentry_team" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_groupsubscription" VALIDATE CONSTRAINT "sentry_groupsubscription_team_id_255af5da_fk_sentry_team_id";
CREATE INDEX CONCURRENTLY "sentry_groupsubscription_team_id_255af5da" ON "sentry_groupsubscription" ("team_id");
--
-- Create constraint subscription_team_or_user_check on model groupsubscription
--
ALTER TABLE "sentry_groupsubscription" ADD CONSTRAINT "subscription_team_or_user_check" CHECK ((("team_id" IS NOT NULL AND "user_id" IS NULL) OR ("team_id" IS NULL AND "user_id" IS NOT NULL))) NOT VALID;
ALTER TABLE "sentry_groupsubscription" VALIDATE CONSTRAINT "subscription_team_or_user_check";

@roggenkemper roggenkemper merged commit 8a3850a into master Sep 12, 2023
52 checks passed
@roggenkemper roggenkemper deleted the roggenkemper/readdteammigration branch September 12, 2023 17:26
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants