-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore: Add 'last_seen' and 'times_seen' columns to table grouptombstone #93682
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
base: master
Are you sure you want to change the base?
chore: Add 'last_seen' and 'times_seen' columns to table grouptombstone #93682
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 #93682 +/- ##
===========================================
+ Coverage 76.56% 88.03% +11.46%
===========================================
Files 10338 10341 +3
Lines 597261 597010 -251
Branches 23193 23138 -55
===========================================
+ Hits 457316 525599 +68283
+ Misses 139484 70955 -68529
+ Partials 461 456 -5 |
…lag' into priscila/chore/add-hit-tracker-columns-to-grouptombstone
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.
Blocking the merge since this can cause some problems
…lag' into priscila/chore/add-hit-tracker-columns-to-grouptombstone
This PR has a migration; here is the generated SQL for for --
-- Add field last_seen to grouptombstone
--
ALTER TABLE "sentry_grouptombstone" ADD COLUMN "last_seen" timestamp with time zone NULL;
--
-- Add field times_seen to grouptombstone
--
ALTER TABLE "sentry_grouptombstone" ADD COLUMN "times_seen" integer DEFAULT 0 NOT NULL CHECK ("times_seen" >= 0); |
@@ -39,6 +39,8 @@ class GroupTombstone(Model): | |||
blank=True, null=True | |||
) | |||
actor_id = BoundedPositiveIntegerField(null=True) | |||
times_seen = BoundedPositiveIntegerField(db_default=0) | |||
last_seen = models.DateTimeField(default=None, null=True) |
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.
Nit: for last_seen
, If you just want the default to be None, you don't need to include this default at all.
If you want it to just be set to the current date/time when the row is first created, you can use auto_now_add=True
instead of using a default.
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 was planning to write another migration just to do that for new future records (rows), and you just saved me from that! thank youuu
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.
ok unfortunately this does not work the way I expected. I would like existing rows to be null and future rows to have a timestamp. There is no another way but creating 2 migrations for that
This PR has a migration; here is the generated SQL for for --
-- Add field last_seen to grouptombstone
--
ALTER TABLE "sentry_grouptombstone" ADD COLUMN "last_seen" timestamp with time zone NULL;
--
-- Add field times_seen to grouptombstone
--
ALTER TABLE "sentry_grouptombstone" ADD COLUMN "times_seen" integer DEFAULT 0 NOT NULL CHECK ("times_seen" >= 0); |
Contributes to https://linear.app/getsentry/issue/TET-595/display-discarded-issue-count-and-timestamp-for-each-entry-in