Skip to content

Commit 686980d

Browse files
feat(crons): Add owner_actor_id to monitor model (#68638)
Refs GH-68623 --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
1 parent 54cf7e5 commit 686980d

File tree

4 files changed

+363
-312
lines changed

4 files changed

+363
-312
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ feedback: 0004_index_together
99
hybridcloud: 0015_apitokenreplica_hashed_token_index
1010
nodestore: 0002_nodestore_no_dictfield
1111
replays: 0004_index_together
12-
sentry: 0692_backfill_group_priority_again
12+
sentry: 0693_add_monitors_ownership_actor_id
1313
social_auth: 0002_default_auto_field
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 5.0.3 on 2024-04-10 21:18
2+
3+
from django.db import migrations
4+
5+
import sentry.db.models.fields.bounded
6+
from sentry.new_migrations.migrations import CheckedMigration
7+
8+
9+
class Migration(CheckedMigration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in production.
11+
# This should only be used for operations where it's safe to run the migration after your
12+
# code has deployed. So this should not be used for most operations that alter the schema
13+
# of a table.
14+
# Here are some things that make sense to mark as post deployment:
15+
# - Large data migrations. Typically we want these to be run manually so that they can be
16+
# monitored and not block the deploy for a long period of time while they run.
17+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
18+
# run this outside deployments so that we don't block them. Note that while adding an index
19+
# is a schema change, it's completely safe to run the operation after the code has deployed.
20+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
21+
22+
is_post_deployment = False
23+
24+
dependencies = [
25+
("sentry", "0692_backfill_group_priority_again"),
26+
]
27+
28+
operations = [
29+
migrations.AddField(
30+
model_name="monitor",
31+
name="owner_actor_id",
32+
field=sentry.db.models.fields.bounded.BoundedBigIntegerField(db_index=True, null=True),
33+
),
34+
]

src/sentry/monitors/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ class Monitor(Model):
249249
Type of monitor. Currently there are only CRON_JOB monitors.
250250
"""
251251

252+
owner_actor_id = BoundedBigIntegerField(null=True, db_index=True)
253+
"""
254+
The owner of the monitors actor_id.
255+
"""
256+
252257
config: models.Field[dict[str, Any], dict[str, Any]] = JSONField(default=dict)
253258
"""
254259
Stores the monitor configuration. See MONITOR_CONFIG for the schema.

0 commit comments

Comments
 (0)