Browse Source

refs(incidents): Remove IncidentSuspectCommit model

Follow-up to https://github.com/getsentry/sentry/pull/16758. This removes the model without
actually removing the table from the databse. We'll remove the table in a final follow-up pr.
Dan Fuller 5 years ago
parent
commit
a470b14909

+ 1 - 1
migrations_lockfile.txt

@@ -10,7 +10,7 @@ auth: 0008_alter_user_username_max_length
 contenttypes: 0002_remove_content_type_name
 jira_ac: 0001_initial
 nodestore: 0001_initial
-sentry: 0038_auto_20200213_1904
+sentry: 0039_delete_incidentsuspectcommit
 sessions: 0001_initial
 sites: 0002_alter_domain_unique
 social_auth: 0001_initial

+ 0 - 14
src/sentry/incidents/models.py

@@ -9,7 +9,6 @@ from enum import Enum
 
 from sentry.db.models import FlexibleForeignKey, Model, UUIDField, OneToOneCascadeDeletes
 from sentry.db.models import ArrayField, sane_repr
-from sentry.db.models.fields.bounded import BoundedBigIntegerField
 from sentry.db.models.manager import BaseManager
 from sentry.models import Team, User
 from sentry.snuba.models import QueryAggregations
@@ -217,19 +216,6 @@ class IncidentSubscription(Model):
     __repr__ = sane_repr("incident_id", "user_id")
 
 
-class IncidentSuspectCommit(Model):
-    __core__ = True
-
-    incident = BoundedBigIntegerField(db_column="incident_id")
-    commit = BoundedBigIntegerField(db_column="commit_id", db_index=True)
-    order = models.SmallIntegerField()
-
-    class Meta:
-        app_label = "sentry"
-        db_table = "sentry_incidentsuspectcommit"
-        unique_together = (("incident", "commit"),)
-
-
 class AlertRuleStatus(Enum):
     PENDING = 0
     TRIGGERED = 1

+ 33 - 0
src/sentry/migrations/0039_delete_incidentsuspectcommit.py

@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.27 on 2020-02-03 22:32
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+    # This flag is used to mark that a migration shouldn't be automatically run in
+    # production. We set this to True for operations that we think are risky and want
+    # someone from ops to run manually and monitor.
+    # General advice is that if in doubt, mark your migration as `is_dangerous`.
+    # Some things you should always mark as dangerous:
+    # - Large data migrations. Typically we want these to be run manually by ops so that
+    #   they can be monitored. Since data migrations will now hold a transaction open
+    #   this is even more important.
+    # - Adding columns to highly active tables, even ones that are NULL.
+    is_dangerous = False
+
+    # This flag is used to decide whether to run this migration in a transaction or not.
+    # By default we prefer to run in a transaction, but for migrations where you want
+    # to `CREATE INDEX CONCURRENTLY` this needs to be set to False. Typically you'll
+    # want to create an index concurrently when adding one to an existing table.
+    atomic = True
+
+    dependencies = [("sentry", "0038_auto_20200213_1904")]
+
+    operations = [
+        migrations.SeparateDatabaseAndState(
+            state_operations=[migrations.DeleteModel(name="IncidentSuspectCommit")],
+            database_operations=[],
+        )
+    ]