-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(hc): Move PagerDutyService into control silo (#53084)
Notably, this migration is a net zero SQL, it only has to change the state of these columns in django. I'll want to add the constraint on organization_integration incrementally as a separate PR for 2 reasons 1. It is unsafe to do so synchronously -- it will be plausible that there are some organization_integration_ids that don't point to existing rows. 2. Related to ^^ but since this column was a HybridCloudForeignKey, it means the cascade was applied asynchronously for deletes. The goal will be to roll this out, making future deletes stop cascading, then manually clean up any objects pointing to missing OIs, *then* roll out the migration that adds the constraint back in.
- Loading branch information
Showing
20 changed files
with
337 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,53 @@ | ||
# Generated by Django 3.2.20 on 2023-07-18 16:07 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations | ||
|
||
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. For | ||
# the most part, 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 dangerous: | ||
# - Large data migrations. Typically we want these to be run manually by ops 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 | ||
# have ops run this and not block the deploy. Note that while adding an index is a schema | ||
# change, it's completely safe to run the operation after the code has deployed. | ||
is_dangerous = False | ||
|
||
dependencies = [ | ||
("sentry", "0515_slugify_invalid_monitors"), | ||
] | ||
|
||
state_operations = [ | ||
migrations.RemoveField( | ||
model_name="pagerdutyservice", | ||
name="organization_integration_id", | ||
), | ||
migrations.AddField( | ||
model_name="pagerdutyservice", | ||
name="organization_integration", | ||
field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( | ||
default=-1, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="sentry.organizationintegration", | ||
db_constraint=False, | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name="pagerdutyservice", | ||
name="organization_id", | ||
field=sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey( | ||
"sentry.Organization", db_index=True, on_delete="CASCADE" | ||
), | ||
), | ||
] | ||
|
||
operations = [migrations.SeparateDatabaseAndState(state_operations=state_operations)] |
This file contains 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 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 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.