-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref(workflow_engine): Updates to the data models #80710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
c6a52de
remove the 'required' field from an action, this is a legacy field.
saponifi3d f5938f1
Remove the temp project_id field and make an association with the pro…
saponifi3d 6145662
Add the ownermodel to the workflow, add 'enabled' flag for snooze
saponifi3d 9025e7c
Update the detector model:
saponifi3d c61e0ca
add environment_id, created_by, frequency, and snoozed fields to Work…
cathteng 2beeebb
remove snooze, we have 'enabled'
cathteng f9efc83
use SET_NULL for HybridCloudForeignKey cascade
cathteng a2b2d00
re-add the organization, it broke a bunch of stuff without it. If a p…
saponifi3d 58b2567
Update detector model
saponifi3d abba861
make this a bounded integer field so it will be droppable correctly
saponifi3d 73c0cda
remove org from test utils
saponifi3d d897914
make required nullable for the first phase of the migration
saponifi3d 14306a0
only make it nullable
saponifi3d 1dea1d3
update snapshots
saponifi3d 09fdacf
add comment to remove field
saponifi3d 82d812e
change how the factories / fixtures work to fix tests
saponifi3d cbb8d09
Change relocation scope back to organization, that's used for the pro…
saponifi3d 25f2ab1
updatee the dependenices after changing the relocation scope
saponifi3d 6a345e8
create an association with the project rather than using a hardcoded 1
saponifi3d b334df0
seems okay, but need to figure out the rest of the details in the jso…
saponifi3d 1e13d61
Update workflow / detector models, and change to have json_config exp…
saponifi3d 52acf94
Update json field to be dict by default
saponifi3d 343a7c7
Add an error to the base models -- helps with typing errors and will …
saponifi3d d071c24
Remove the test for the mixin cause it seems like it's problematic. j…
saponifi3d eef52e4
PR Feedback
saponifi3d 24e9f9b
GENERATED - SQL Migration
saponifi3d 1bca30a
GENERATED - Update Model Dependencies
saponifi3d f9fc70c
GENERATED - Update snapshots
saponifi3d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
src/sentry/workflow_engine/migrations/0014_model_additions_for_milestones.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # Generated by Django 5.1.1 on 2024-11-21 21:05 | ||
|
|
||
| import django.db.models.deletion | ||
| from django.db import migrations, models | ||
|
|
||
| import sentry.db.models.fields.foreignkey | ||
| import sentry.db.models.fields.hybrid_cloud_foreign_key | ||
| 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 = [ | ||
| ("sentry", "0792_add_unique_index_apiauthorization"), | ||
| ("workflow_engine", "0013_related_name_conditions_on_dcg"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="detector", | ||
| name="config", | ||
| field=models.JSONField(db_default={}), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="detector", | ||
| name="created_by_id", | ||
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="SET_NULL" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="detector", | ||
| name="description", | ||
| field=models.TextField(null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="detector", | ||
| name="enabled", | ||
| field=models.BooleanField(db_default=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="detector", | ||
| name="project", | ||
| field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.CASCADE, to="sentry.project" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="config", | ||
| field=models.JSONField(db_default={}), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="created_by_id", | ||
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="SET_NULL" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="enabled", | ||
| field=models.BooleanField(db_default=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="environment", | ||
| field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.CASCADE, to="sentry.environment" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="owner_team", | ||
| field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.SET_NULL, to="sentry.team" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="workflow", | ||
| name="owner_user_id", | ||
| field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
| "sentry.User", db_index=True, null=True, on_delete="SET_NULL" | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="action", | ||
| name="required", | ||
| field=models.BooleanField(default=False, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="detector", | ||
| name="organization", | ||
| field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
| null=True, on_delete=django.db.models.deletion.CASCADE, to="sentry.organization" | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="workflow", | ||
| name="when_condition_group", | ||
| field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
| null=True, | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| to="workflow_engine.dataconditiongroup", | ||
| ), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFYI: I've got an operation coming soon that will make deleting these things simpler #81098