Skip to content

Commit 9aa74bb

Browse files
evanpurkhiserandrewshie-sentry
authored andcommitted
ref(crons): Remove monitors Location model (state) (#88704)
1 parent cd11ccf commit 9aa74bb

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ remote_subscriptions: 0003_drop_remote_subscription
1717

1818
replays: 0004_index_together
1919

20-
sentry: 0860_add_new_groupopenperiod_constraint
20+
sentry: 0861_monitors_remove_location
2121

2222
social_auth: 0002_default_auto_field
2323

src/sentry/db/router.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class SiloRouter:
7474
"authprovider_duplicate": SiloMode.CONTROL,
7575
"authidentity_duplicate": SiloMode.CONTROL,
7676
"sentry_alertruleactivations": SiloMode.REGION,
77+
"sentry_monitorlocation": SiloMode.REGION,
7778
}
7879
"""
7980
When we remove models, we are no longer able to resolve silo assignments
@@ -218,9 +219,9 @@ class TestSiloMultiDatabaseRouter(SiloRouter):
218219
secondary_db_models = {
219220
"sentry_monitor",
220221
"sentry_monitorcheckin",
221-
"sentry_monitorlocation",
222222
"sentry_monitorenvironment",
223223
"sentry_monitorincident",
224+
"sentry_monitorlocation",
224225
"sentry_monitorenvbrokendetection",
225226
}
226227

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Generated by Django 5.1.7 on 2025-04-01 20:43
2+
3+
from sentry.new_migrations.migrations import CheckedMigration
4+
from sentry.new_migrations.monkey.models import SafeDeleteModel
5+
from sentry.new_migrations.monkey.state import DeletionAction
6+
7+
8+
class Migration(CheckedMigration):
9+
# This flag is used to mark that a migration shouldn't be automatically run in production.
10+
# This should only be used for operations where it's safe to run the migration after your
11+
# code has deployed. So this should not be used for most operations that alter the schema
12+
# of a table.
13+
# Here are some things that make sense to mark as post deployment:
14+
# - Large data migrations. Typically we want these to be run manually so that they can be
15+
# 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+
# run this outside deployments so that we don't block them. Note that while adding an index
18+
# is a schema change, it's completely safe to run the operation after the code has deployed.
19+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
20+
21+
is_post_deployment = False
22+
23+
dependencies = [
24+
("sentry", "0860_add_new_groupopenperiod_constraint"),
25+
]
26+
27+
operations = [
28+
SafeDeleteModel(name="MonitorLocation", deletion_action=DeletionAction.MOVE_TO_PENDING)
29+
]

src/sentry/monitors/models.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -580,22 +580,6 @@ def _update_timestamps(self):
580580
pass
581581

582582

583-
@region_silo_model
584-
class MonitorLocation(Model):
585-
__relocation_scope__ = RelocationScope.Excluded
586-
587-
guid = UUIDField(unique=True, auto_add=True)
588-
name = models.CharField(max_length=128)
589-
date_added = models.DateTimeField(default=timezone.now)
590-
objects: ClassVar[BaseManager[Self]] = BaseManager(cache_fields=("guid",))
591-
592-
class Meta:
593-
app_label = "sentry"
594-
db_table = "sentry_monitorlocation"
595-
596-
__repr__ = sane_repr("guid", "name")
597-
598-
599583
class MonitorEnvironmentManager(BaseManager["MonitorEnvironment"]):
600584
"""
601585
A manager that consolidates logic for monitor environment updates

0 commit comments

Comments
 (0)