-
-
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
chore(alerts): Remove activated alert models #83255
Conversation
SafeDeleteModel( | ||
name="AlertRuleActivations", deletion_action=DeletionAction.MOVE_TO_PENDING | ||
), | ||
] |
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.
Removing the models also generated this:
migrations.RemoveField(
model_name="alertruleactivations",
name="alert_rule",
),
migrations.RemoveField(
model_name="alertruleactivations",
name="query_subscription",
),
but I think this has happened in the past and we removed it without error. I was able to run the migration locally fine.
This PR has a migration; here is the generated SQL for --
-- Alter field alert_rule on alertruleactivationcondition
--
SET CONSTRAINTS "sentry_alertruleacti_alert_rule_id_8373d2c0_fk_sentry_al" IMMEDIATE; ALTER TABLE "sentry_alertruleactivationcondition" DROP CONSTRAINT "sentry_alertruleacti_alert_rule_id_8373d2c0_fk_sentry_al";
--
-- Alter field alert_rule on alertruleactivations
--
SET CONSTRAINTS "sentry_alertruleacti_alert_rule_id_772efdf6_fk_sentry_al" IMMEDIATE; ALTER TABLE "sentry_alertruleactivations" DROP CONSTRAINT "sentry_alertruleacti_alert_rule_id_772efdf6_fk_sentry_al";
--
-- Alter field query_subscription on alertruleactivations
--
SET CONSTRAINTS "sentry_alertruleacti_query_subscription_i_d1458737_fk_sentry_qu" IMMEDIATE; ALTER TABLE "sentry_alertruleactivations" DROP CONSTRAINT "sentry_alertruleacti_query_subscription_i_d1458737_fk_sentry_qu";
--
-- Moved model AlertRuleActivationCondition to pending deletion state
--
-- (no-op)
--
-- Moved model AlertRuleActivations to pending deletion state
--
-- (no-op) |
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.
This lgtm, will we also write a cleanup script to remove any of these old alerts?
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 #83255 +/- ##
==========================================
- Coverage 87.55% 87.54% -0.02%
==========================================
Files 9470 9393 -77
Lines 537266 536812 -454
Branches 21148 21148
==========================================
- Hits 470379 469927 -452
+ Misses 66529 66527 -2
Partials 358 358 |
There are very few - a handful that have a snapshot status and 5 in sentry orgs that I for some reason can't pull up. Even if there were more I don't think we need to worry about cleaning them up since we will simply not migrate them to the new ACI tables. |
@@ -31,6 +33,7 @@ def setup_before_migration(self, app): | |||
GroupInbox.objects.create(group=self.ignored_group, reason=GroupInboxReason.NEW.value) | |||
GroupInbox.objects.create(group=self.unresolved_group, reason=GroupInboxReason.NEW.value) | |||
|
|||
@pytest.mark.skip(reason="unneeded") |
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.
maybe I can just fully delete this, I don't think we need old migrations tests do we?
Good point, no need to clean up old data in these tables at all |
PR reverted: 0123b4a |
This reverts commit d8966ed. Co-authored-by: ceorourke <[email protected]>
Final follow up to #83255 to actually remove the models now
Follow up to #83248 to remove the activated alert models.