Skip to content

Commit b8552b1

Browse files
evanpurkhiservolokluev
authored andcommitted
ref(crons): Remove {next,last}_checkin from monitor model (state) (#49132)
This column is now unused (as monitor environments track these)
1 parent f19a3d7 commit b8552b1

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ To resolve this, rebase against latest master and regenerate your migration. Thi
66
will then be regenerated, and you should be able to merge without conflicts.
77

88
nodestore: 0002_nodestore_no_dictfield
9-
sentry: 0443_check_notification_team_or_user
9+
sentry: 0444_remove_next_checkin_last_checkin_from_monitor
1010
social_auth: 0001_initial
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Generated by Django 2.2.28 on 2023-05-15 20:15
2+
3+
from django.db import migrations
4+
5+
from sentry.new_migrations.migrations import CheckedMigration
6+
7+
8+
class Migration(CheckedMigration):
9+
# This flag is used to mark that a migration shouldn't be automatically run in production. For
10+
# the most part, this should only be used for operations where it's safe to run the migration
11+
# after your code has deployed. So this should not be used for most operations that alter the
12+
# schema of a table.
13+
# Here are some things that make sense to mark as dangerous:
14+
# - Large data migrations. Typically we want these to be run manually by ops so that they can
15+
# be monitored and not block the deploy for a long period of time while they run.
16+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
17+
# have ops run this and not block the deploy. Note that while adding an index is a schema
18+
# change, it's completely safe to run the operation after the code has deployed.
19+
is_dangerous = False
20+
21+
dependencies = [
22+
("sentry", "0443_check_notification_team_or_user"),
23+
]
24+
25+
operations = [
26+
migrations.SeparateDatabaseAndState(
27+
state_operations=[
28+
migrations.RemoveField(
29+
model_name="monitor",
30+
name="next_checkin",
31+
),
32+
migrations.RemoveField(
33+
model_name="monitor",
34+
name="last_checkin",
35+
),
36+
migrations.AlterIndexTogether(
37+
name="monitor",
38+
index_together=set(),
39+
),
40+
]
41+
)
42+
]

src/sentry/monitors/models.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,11 @@ class Monitor(Model):
217217
choices=[(k, str(v)) for k, v in MonitorType.as_choices()],
218218
)
219219
config = JSONField(default=dict)
220-
next_checkin = models.DateTimeField(null=True)
221-
last_checkin = models.DateTimeField(null=True)
222220
date_added = models.DateTimeField(default=timezone.now)
223221

224222
class Meta:
225223
app_label = "sentry"
226224
db_table = "sentry_monitor"
227-
index_together = (("type", "next_checkin"),)
228225
unique_together = (("organization_id", "slug"),)
229226

230227
__repr__ = sane_repr("guid", "project_id", "name")

0 commit comments

Comments
 (0)