-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore(migrations): Fix up failed deletes #103703
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
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
36 changes: 36 additions & 0 deletions
36
src/sentry/feedback/migrations/0007_cleanup_failed_safe_deletes.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,36 @@ | ||
| # Generated by Django 5.2.8 on 2025-11-19 00:38 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
| from sentry.new_migrations.monkey.special import SafeRunSQL | ||
|
|
||
|
|
||
| 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 = [ | ||
| ("feedback", "0006_safe_del_feedback_model"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # Clean up table that may not have been deleted due to missing | ||
| # historical_silo_assignments entry before the fix | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS feedback_feedback CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["feedback_feedback"]}, | ||
| ), | ||
| ] |
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,41 @@ | ||
| # Generated by Django 5.2.8 on 2025-11-19 00:37 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
| from sentry.new_migrations.monkey.special import SafeRunSQL | ||
|
|
||
|
|
||
| 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 | ||
wedamija marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| dependencies = [ | ||
| ("sentry", "1006_drop_legacy_incidentseen_incidentsubscription"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # Clean up tables that may not have been deleted due to missing | ||
| # historical_silo_assignments entries before the fix | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS sentry_datasecrecywaiver CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["sentry_datasecrecywaiver"]}, | ||
| ), | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS sentry_dashboardwidgetsnapshot CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["sentry_dashboardwidgetsnapshot"]}, | ||
| ), | ||
| ] | ||
41 changes: 41 additions & 0 deletions
41
src/sentry/releases/migrations/0004_cleanup_failed_safe_deletes.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,41 @@ | ||
| # Generated by Django 5.2.8 on 2025-11-19 00:38 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
| from sentry.new_migrations.monkey.special import SafeRunSQL | ||
|
|
||
|
|
||
| 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 = [ | ||
| ("releases", "0003_real_delete_dual_written_commit_tables"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # Clean up tables that may not have been deleted due to missing | ||
| # historical_silo_assignments entries before the fix | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS releases_commit CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["releases_commit"]}, | ||
| ), | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS releases_commitfilechange CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["releases_commitfilechange"]}, | ||
| ), | ||
| ] |
36 changes: 36 additions & 0 deletions
36
src/sentry/uptime/migrations/0049_cleanup_failed_safe_deletes.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,36 @@ | ||
| # Generated by Django 5.2.8 on 2025-11-19 00:38 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
| from sentry.new_migrations.monkey.special import SafeRunSQL | ||
|
|
||
|
|
||
| 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 = [ | ||
| ("uptime", "0048_delete_uptime_status_columns"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # Clean up table that may not have been deleted due to missing | ||
| # historical_silo_assignments entry before the fix | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS uptime_projectuptimesubscription CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["uptime_projectuptimesubscription"]}, | ||
| ), | ||
| ] |
36 changes: 36 additions & 0 deletions
36
src/sentry/workflow_engine/migrations/0102_cleanup_failed_safe_deletes.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,36 @@ | ||
| # Generated by Django 5.2.8 on 2025-11-19 00:38 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
| from sentry.new_migrations.migrations import CheckedMigration | ||
| from sentry.new_migrations.monkey.special import SafeRunSQL | ||
|
|
||
|
|
||
| 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", "0101_remove_is_single_written_field"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| # Clean up table that may not have been deleted due to missing | ||
| # historical_silo_assignments entry before the fix | ||
| SafeRunSQL( | ||
| sql="DROP TABLE IF EXISTS workflow_engine_actiongroupstatus CASCADE;", | ||
| reverse_sql=migrations.RunSQL.noop, | ||
| hints={"tables": ["workflow_engine_actiongroupstatus"]}, | ||
| ), | ||
| ] |
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.
Uh oh!
There was an error while loading. Please reload this page.