Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion migrations_lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ social_auth: 0002_default_auto_field

uptime: 0018_add_trace_sampling_field_to_uptime

workflow_engine: 0014_model_additions_for_milestones
workflow_engine: 0015_workflow_engine_changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 5.1.1 on 2024-12-03 18:45

from django.db import migrations, models

from sentry.new_migrations.migrations import CheckedMigration


class Migration(CheckedMigration):
# This flag is used to mark that a migration shouldn't be automatically run in production.
# This should only be used for operations where it's safe to run the migration after your
# code has deployed. So this should not be used for most operations that alter the schema
# of a table.
# Here are some things that make sense to mark as post deployment:
# - Large data migrations. Typically we want these to be run manually so that they can be
# monitored and not block the deploy for a long period of time while they run.
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
# run this outside deployments so that we don't block them. Note that while adding an index
# is a schema change, it's completely safe to run the operation after the code has deployed.
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment

is_post_deployment = False

dependencies = [
("workflow_engine", "0014_model_additions_for_milestones"),
]

operations = [
migrations.AddField(
model_name="workflow",
name="frequency",
field=models.IntegerField(default=30),
),
]
4 changes: 4 additions & 0 deletions src/sentry/workflow_engine/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Workflow(DefaultFieldsModel, OwnerModel, JSONConfigBase):
Workflows are initiated after detectors have been processed, driven by changes to their state.
"""

DEFAULT_FREQUENCY = 30 # minutes

__relocation_scope__ = RelocationScope.Organization
name = models.CharField(max_length=200)
organization = FlexibleForeignKey("sentry.Organization")
Expand All @@ -32,6 +34,8 @@ class Workflow(DefaultFieldsModel, OwnerModel, JSONConfigBase):

created_by_id = HybridCloudForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete="SET_NULL")

frequency = models.IntegerField(default=DEFAULT_FREQUENCY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi, we removed this from the other db migration because this only applies to issue alerts, instead we can make a subclass an ad the frequency to the config property.

Here's a link to that discussion: #80710 (comment) / why it wasn't added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i missed that, thanks!


@property
def CONFIG_SCHEMA(self) -> dict[str, Any]:
raise NotImplementedError('Subclasses must define a "CONFIG_SCHEMA" attribute')
Expand Down
Loading