From 5ecd08e3c2bdfe9405049a719928bfc20319a203 Mon Sep 17 00:00:00 2001 From: Cathy Teng Date: Mon, 19 May 2025 15:38:24 -0700 Subject: [PATCH] pending delete WorkflowFireHistory rollout columns --- migrations_lockfile.txt | 2 +- ...rop_rollout_workflowfirehistory_columns.py | 39 +++++++++++++++++++ .../models/workflow_fire_history.py | 8 ---- 3 files changed, 40 insertions(+), 9 deletions(-) create mode 100644 src/sentry/workflow_engine/migrations/0063_drop_rollout_workflowfirehistory_columns.py diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt index 69ae91b8d810b2..7e3554cdb63b4e 100644 --- a/migrations_lockfile.txt +++ b/migrations_lockfile.txt @@ -29,4 +29,4 @@ tempest: 0002_make_message_type_nullable uptime: 0042_extra_uptime_indexes -workflow_engine: 0062_workflow_engine_missing_indexes +workflow_engine: 0063_drop_rollout_workflowfirehistory_columns diff --git a/src/sentry/workflow_engine/migrations/0063_drop_rollout_workflowfirehistory_columns.py b/src/sentry/workflow_engine/migrations/0063_drop_rollout_workflowfirehistory_columns.py new file mode 100644 index 00000000000000..9dc73fd64013a3 --- /dev/null +++ b/src/sentry/workflow_engine/migrations/0063_drop_rollout_workflowfirehistory_columns.py @@ -0,0 +1,39 @@ +# Generated by Django 5.2.1 on 2025-05-19 22:35 + + +from sentry.new_migrations.migrations import CheckedMigration +from sentry.new_migrations.monkey.fields import SafeRemoveField +from sentry.new_migrations.monkey.state import DeletionAction + + +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", "0062_workflow_engine_missing_indexes"), + ] + + operations = [ + SafeRemoveField( + model_name="workflowfirehistory", + name="has_fired_actions", + deletion_action=DeletionAction.MOVE_TO_PENDING, + ), + SafeRemoveField( + model_name="workflowfirehistory", + name="has_passed_filters", + deletion_action=DeletionAction.MOVE_TO_PENDING, + ), + ] diff --git a/src/sentry/workflow_engine/models/workflow_fire_history.py b/src/sentry/workflow_engine/models/workflow_fire_history.py index a3bff542344714..26a9649fbb30b9 100644 --- a/src/sentry/workflow_engine/models/workflow_fire_history.py +++ b/src/sentry/workflow_engine/models/workflow_fire_history.py @@ -1,5 +1,3 @@ -from django.db import models - from sentry.backup.scopes import RelocationScope from sentry.db.models import CharField, FlexibleForeignKey, region_silo_model, sane_repr from sentry.db.models.base import DefaultFieldsModel @@ -14,12 +12,6 @@ class WorkflowFireHistory(DefaultFieldsModel): group = FlexibleForeignKey("sentry.Group", db_constraint=False) event_id = CharField(max_length=32) notification_uuid = UUIDField(auto_add=True, unique=True) - has_passed_filters = models.BooleanField( - null=True - ) # used for rollout -- whether the workflow passed all filters - has_fired_actions = models.BooleanField( - default=False, db_default=False - ) # used for rollout -- whether at least one group of actions was triggered (Rules have 1 group of actions) class Meta: db_table = "workflow_engine_workflowfirehistory"