Skip to content

Commit feedc76

Browse files
yuvmenjasonyuezhang
authored andcommitted
fix(deletions): Fix MonitorIncident FK to MonitorCheckIn cascade
While these FKs are supposed to have CASCADE on them according to our models, they are in fact not in the DB. Trying to run this to force them to be CASCADE
1 parent 0ddf3f6 commit feedc76

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ hybridcloud: 0024_add_project_distribution_scope
1717

1818
insights: 0002_backfill_team_starred
1919

20-
monitors: 0012_remove_monitor_is_muted_field
20+
monitors: 0013_fix_monitorincident_checkin_cascade
2121

2222
nodestore: 0001_squashed_0002_nodestore_no_dictfield
2323

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Generated by Django 5.2.8 on 2025-11-19 23:35
2+
3+
import django.db.models.deletion
4+
from django.db import migrations
5+
6+
import sentry.db.models.fields.foreignkey
7+
from sentry.new_migrations.migrations import CheckedMigration
8+
9+
10+
class Migration(CheckedMigration):
11+
# This flag is used to mark that a migration shouldn't be automatically run in production.
12+
# This should only be used for operations where it's safe to run the migration after your
13+
# code has deployed. So this should not be used for most operations that alter the schema
14+
# of a table.
15+
# Here are some things that make sense to mark as post deployment:
16+
# - Large data migrations. Typically we want these to be run manually so that they can be
17+
# monitored and not block the deploy for a long period of time while they run.
18+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
19+
# run this outside deployments so that we don't block them. Note that while adding an index
20+
# is a schema change, it's completely safe to run the operation after the code has deployed.
21+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
22+
23+
is_post_deployment = False
24+
25+
dependencies = [
26+
("monitors", "0012_remove_monitor_is_muted_field"),
27+
]
28+
29+
operations = [
30+
migrations.AlterField(
31+
model_name="monitorincident",
32+
name="starting_checkin",
33+
field=sentry.db.models.fields.foreignkey.FlexibleForeignKey(
34+
null=True,
35+
on_delete=django.db.models.deletion.CASCADE,
36+
related_name="created_incidents",
37+
to="monitors.monitorcheckin",
38+
),
39+
),
40+
migrations.AlterField(
41+
model_name="monitorincident",
42+
name="resolving_checkin",
43+
field=sentry.db.models.fields.foreignkey.FlexibleForeignKey(
44+
null=True,
45+
on_delete=django.db.models.deletion.CASCADE,
46+
related_name="resolved_incidents",
47+
to="monitors.monitorcheckin",
48+
),
49+
),
50+
]

0 commit comments

Comments
 (0)