-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore(alerts): Remove incidentseen and incidentsubscription models #81605
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 incidentseen and incidentsubscription models #81605
Conversation
|
This PR has a migration; here is the generated SQL for --
-- Alter field incident on incidentseen
--
SET CONSTRAINTS "sentry_incidentseen_incident_id_008cf29b_fk_sentry_incident_id" IMMEDIATE; ALTER TABLE "sentry_incidentseen" DROP CONSTRAINT "sentry_incidentseen_incident_id_008cf29b_fk_sentry_incident_id";
--
-- Alter field user_id on incidentseen
--
ALTER TABLE "sentry_incidentseen" ALTER COLUMN "user_id" DROP NOT NULL;
--
-- Alter field incident on incidentsubscription
--
SET CONSTRAINTS "sentry_incidentsubsc_incident_id_6d439453_fk_sentry_in" IMMEDIATE; ALTER TABLE "sentry_incidentsubscription" DROP CONSTRAINT "sentry_incidentsubsc_incident_id_6d439453_fk_sentry_in";
--
-- Alter field user_id on incidentsubscription
--
ALTER TABLE "sentry_incidentsubscription" ALTER COLUMN "user_id" DROP NOT NULL;
--
-- Moved model IncidentSeen to pending deletion state
--
-- (no-op)
--
-- Moved model IncidentSubscription to pending deletion state
--
-- (no-op) |
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="CASCADE" | ||
| ), | ||
| ), |
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.
When I generated the 2nd part of removing the models from code it also generated this:
migrations.AlterUniqueTogether(
name="incidentsubscription",
unique_together=None,
),
SafeRemoveField(
model_name="incidentsubscription",
name="incident",
deletion_action=DeletionAction.MOVE_TO_PENDING,
),
but it did the same in #81264 and I had removed it without issue.
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.
Since you're going to be dropping the table shortly, the AlterUniqueTogether operation isn't that important as postgres will drop the constraint when the table is dropped.
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 #81605 +/- ##
==========================================
+ Coverage 80.45% 80.50% +0.05%
==========================================
Files 7241 7241
Lines 321452 322387 +935
Branches 20807 20807
==========================================
+ Hits 258621 259537 +916
- Misses 62432 62451 +19
Partials 399 399 |
|
🚨 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 |
markstory
left a comment
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.
Looks good to me, constraints are being removed and columns made nullable alongside the state update for table removal 👍
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="CASCADE" | ||
| ), | ||
| ), |
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.
Since you're going to be dropping the table shortly, the AlterUniqueTogether operation isn't that important as postgres will drop the constraint when the table is dropped.
The final follow up to #81605 to drop the `IncidentSeen` and `IncidentSubscription` tables.
Another follow up to #81522 to remove the unused models. A final PR will follow to drop the tables.