Skip to content

Commit 6a390a0

Browse files
asottile-sentryandrewshie-sentry
authored andcommitted
ref: move notifications models to a separate django app (#93582)
this breaks the migration cycle between sentry<=>workflow_engine <!-- Describe your PR here. -->
1 parent 135b60a commit 6a390a0

File tree

10 files changed

+490
-14
lines changed

10 files changed

+490
-14
lines changed

migrations_lockfile.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ monitors: 0006_add_is_upserting
1919

2020
nodestore: 0001_squashed_0002_nodestore_no_dictfield
2121

22+
notifications: 0001_move_notifications_models
23+
2224
preprod: 0004_add_django_jsonfield
2325

2426
replays: 0001_squashed_0005_drop_replay_index
2527

26-
sentry: 0927_dashboard_add_unique_constraint_user_dashboard
28+
sentry: 0928_move_notifications_models
2729

2830
social_auth: 0001_squashed_0002_default_auto_field
2931

src/sentry/conf/server.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3425,20 +3425,21 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
34253425
# Specifies the list of django apps to include in the lockfile. If Falsey then include
34263426
# all apps with migrations
34273427
MIGRATIONS_LOCKFILE_APP_WHITELIST = (
3428+
"explore",
3429+
"feedback",
34283430
"flags",
3431+
"hybridcloud",
3432+
"insights",
3433+
"monitors",
34293434
"nodestore",
3435+
"notifications",
3436+
"preprod",
34303437
"replays",
34313438
"sentry",
34323439
"social_auth",
3433-
"feedback",
3434-
"hybridcloud",
3440+
"tempest",
34353441
"uptime",
34363442
"workflow_engine",
3437-
"tempest",
3438-
"explore",
3439-
"insights",
3440-
"monitors",
3441-
"preprod",
34423443
)
34433444
# Where to write the lockfile to.
34443445
MIGRATIONS_LOCKFILE_PATH = os.path.join(PROJECT_ROOT, os.path.pardir, os.path.pardir)
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Generated by Django 5.2.1 on 2025-06-14 16:22
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.
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", "0927_dashboard_add_unique_constraint_user_dashboard"),
25+
]
26+
27+
operations = [
28+
migrations.SeparateDatabaseAndState(
29+
state_operations=[
30+
migrations.RemoveField(
31+
model_name="notificationactionproject",
32+
name="action",
33+
),
34+
migrations.RemoveField(
35+
model_name="notificationactionproject",
36+
name="project",
37+
),
38+
migrations.RemoveField(
39+
model_name="notificationmessage",
40+
name="action",
41+
),
42+
migrations.RemoveField(
43+
model_name="notificationmessage",
44+
name="group",
45+
),
46+
migrations.RemoveField(
47+
model_name="notificationmessage",
48+
name="incident",
49+
),
50+
migrations.RemoveField(
51+
model_name="notificationmessage",
52+
name="parent_notification_message",
53+
),
54+
migrations.RemoveField(
55+
model_name="notificationmessage",
56+
name="rule_fire_history",
57+
),
58+
migrations.RemoveField(
59+
model_name="notificationmessage",
60+
name="trigger_action",
61+
),
62+
migrations.AlterUniqueTogether(
63+
name="notificationsettingoption",
64+
unique_together=None,
65+
),
66+
migrations.RemoveField(
67+
model_name="notificationsettingoption",
68+
name="user",
69+
),
70+
migrations.AlterUniqueTogether(
71+
name="notificationsettingprovider",
72+
unique_together=None,
73+
),
74+
migrations.RemoveField(
75+
model_name="notificationsettingprovider",
76+
name="user",
77+
),
78+
migrations.DeleteModel(
79+
name="NotificationAction",
80+
),
81+
migrations.DeleteModel(
82+
name="NotificationActionProject",
83+
),
84+
migrations.DeleteModel(
85+
name="NotificationMessage",
86+
),
87+
migrations.DeleteModel(
88+
name="NotificationSettingOption",
89+
),
90+
migrations.DeleteModel(
91+
name="NotificationSettingProvider",
92+
),
93+
]
94+
)
95+
]

src/sentry/notifications/apps.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from django.apps import AppConfig
2+
3+
4+
class Config(AppConfig):
5+
name = "sentry.notifications"
6+
7+
def ready(self):
8+
pass

0 commit comments

Comments
 (0)