Browse Source

ref(crons): Remove {next,last}_checkin from monitor model (state) (#49132)

This column is now unused (as monitor environments track these)
Evan Purkhiser 1 year ago
parent
commit
7700fb00c6

+ 1 - 1
migrations_lockfile.txt

@@ -6,5 +6,5 @@ To resolve this, rebase against latest master and regenerate your migration. Thi
 will then be regenerated, and you should be able to merge without conflicts.
 
 nodestore: 0002_nodestore_no_dictfield
-sentry: 0443_check_notification_team_or_user
+sentry: 0444_remove_next_checkin_last_checkin_from_monitor
 social_auth: 0001_initial

+ 42 - 0
src/sentry/migrations/0444_remove_next_checkin_last_checkin_from_monitor.py

@@ -0,0 +1,42 @@
+# Generated by Django 2.2.28 on 2023-05-15 20:15
+
+from django.db import migrations
+
+from sentry.new_migrations.migrations import CheckedMigration
+
+
+class Migration(CheckedMigration):
+    # This flag is used to mark that a migration shouldn't be automatically run in production. For
+    # the most part, this should only be used for operations where it's safe to run the migration
+    # after your code has deployed. So this should not be used for most operations that alter the
+    # schema of a table.
+    # Here are some things that make sense to mark as dangerous:
+    # - Large data migrations. Typically we want these to be run manually by ops so that they can
+    #   be monitored and not block the deploy for a long period of time while they run.
+    # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
+    #   have ops run this and not block the deploy. Note that while adding an index is a schema
+    #   change, it's completely safe to run the operation after the code has deployed.
+    is_dangerous = False
+
+    dependencies = [
+        ("sentry", "0443_check_notification_team_or_user"),
+    ]
+
+    operations = [
+        migrations.SeparateDatabaseAndState(
+            state_operations=[
+                migrations.RemoveField(
+                    model_name="monitor",
+                    name="next_checkin",
+                ),
+                migrations.RemoveField(
+                    model_name="monitor",
+                    name="last_checkin",
+                ),
+                migrations.AlterIndexTogether(
+                    name="monitor",
+                    index_together=set(),
+                ),
+            ]
+        )
+    ]

+ 0 - 3
src/sentry/monitors/models.py

@@ -217,14 +217,11 @@ class Monitor(Model):
         choices=[(k, str(v)) for k, v in MonitorType.as_choices()],
     )
     config = JSONField(default=dict)
-    next_checkin = models.DateTimeField(null=True)
-    last_checkin = models.DateTimeField(null=True)
     date_added = models.DateTimeField(default=timezone.now)
 
     class Meta:
         app_label = "sentry"
         db_table = "sentry_monitor"
-        index_together = (("type", "next_checkin"),)
         unique_together = (("organization_id", "slug"),)
 
     __repr__ = sane_repr("guid", "project_id", "name")