From 3a0894f7235d4d00d05f968588dafc176d6960bf Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Tue, 20 May 2025 22:27:37 -0400 Subject: [PATCH] ref: remove remote_subscriptions migrations this is a noop now and after the last hard stop already --- migrations_lockfile.txt | 2 - pyproject.toml | 1 - src/sentry/conf/server.py | 1 - .../migrations/0001_remote_subscription.py | 49 ------------------- ...002_remove_separate_remote_subscription.py | 36 -------------- .../0003_drop_remote_subscription.py | 34 ------------- .../migrations/__init__.py | 0 .../migrations/0001_uptime_subscriptions.py | 9 ---- ...002_remove_separate_remote_subscription.py | 17 ------- .../0003_drop_remote_subscription.py | 13 +---- 10 files changed, 1 insertion(+), 161 deletions(-) delete mode 100644 src/sentry/remote_subscriptions/migrations/0001_remote_subscription.py delete mode 100644 src/sentry/remote_subscriptions/migrations/0002_remove_separate_remote_subscription.py delete mode 100644 src/sentry/remote_subscriptions/migrations/0003_drop_remote_subscription.py delete mode 100644 src/sentry/remote_subscriptions/migrations/__init__.py diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt index ee051e8b4de71e..dd0480c454dc20 100644 --- a/migrations_lockfile.txt +++ b/migrations_lockfile.txt @@ -19,8 +19,6 @@ monitors: 0005_record_date_in_progress_state nodestore: 0002_nodestore_no_dictfield -remote_subscriptions: 0003_drop_remote_subscription - replays: 0005_drop_replay_index sentry: 0904_onboarding_task_project_id_idx diff --git a/pyproject.toml b/pyproject.toml index ff0410eb556ab3..412f0aaefcf722 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -350,7 +350,6 @@ module = [ "sentry.release_health.release_monitor.*", "sentry.relocation.api.endpoints.artifacts.*", "sentry.relocation.services.relocation_export.*", - "sentry.remote_subscriptions.migrations.*", "sentry.replays.consumers.*", "sentry.replays.lib.new_query.*", "sentry.replays.migrations.*", diff --git a/src/sentry/conf/server.py b/src/sentry/conf/server.py index 9adfd41d3d027a..d89fcda2c11dab 100644 --- a/src/sentry/conf/server.py +++ b/src/sentry/conf/server.py @@ -3202,7 +3202,6 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]: "social_auth", "feedback", "hybridcloud", - "remote_subscriptions", "uptime", "workflow_engine", "tempest", diff --git a/src/sentry/remote_subscriptions/migrations/0001_remote_subscription.py b/src/sentry/remote_subscriptions/migrations/0001_remote_subscription.py deleted file mode 100644 index 2d05437903bf31..00000000000000 --- a/src/sentry/remote_subscriptions/migrations/0001_remote_subscription.py +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by Django 5.0.6 on 2024-06-20 18:26 - -import django.utils.timezone -from django.db import migrations, models - -import sentry.db.models.fields.bounded -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 - - initial = True - - dependencies = [] - - operations = [ - migrations.CreateModel( - name="RemoteSubscription", - fields=[ - ( - "id", - sentry.db.models.fields.bounded.BoundedBigAutoField( - primary_key=True, serialize=False - ), - ), - ("date_updated", models.DateTimeField(default=django.utils.timezone.now)), - ("date_added", models.DateTimeField(default=django.utils.timezone.now, null=True)), - ("type", models.TextField()), - ("status", models.SmallIntegerField(db_index=True, default=0)), - ("subscription_id", models.TextField(null=True, unique=True)), - ], - options={ - "db_table": "sentry_remotesubscription", - }, - ), - ] diff --git a/src/sentry/remote_subscriptions/migrations/0002_remove_separate_remote_subscription.py b/src/sentry/remote_subscriptions/migrations/0002_remove_separate_remote_subscription.py deleted file mode 100644 index 5f7783cd78a97b..00000000000000 --- a/src/sentry/remote_subscriptions/migrations/0002_remove_separate_remote_subscription.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 5.0.6 on 2024-06-21 17:12 - -from django.db import migrations - -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 = [ - ("remote_subscriptions", "0001_remote_subscription"), - ("uptime", "0002_remove_separate_remote_subscription"), - ] - - operations = [ - migrations.SeparateDatabaseAndState( - state_operations=[ - migrations.DeleteModel( - name="RemoteSubscription", - ), - ] - ) - ] diff --git a/src/sentry/remote_subscriptions/migrations/0003_drop_remote_subscription.py b/src/sentry/remote_subscriptions/migrations/0003_drop_remote_subscription.py deleted file mode 100644 index 21c5d0a12a4c6c..00000000000000 --- a/src/sentry/remote_subscriptions/migrations/0003_drop_remote_subscription.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 5.0.6 on 2024-06-21 22:01 -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 = [ - ("remote_subscriptions", "0002_remove_separate_remote_subscription"), - ("uptime", "0003_drop_remote_subscription"), - ] - - operations = [ - SafeRunSQL( - """ - DROP TABLE "sentry_remotesubscription"; - """, - reverse_sql="CREATE TABLE sentry_remotesubscription (fake_col int)", - hints={"tables": ["sentry_remotesubscription"]}, - ) - ] diff --git a/src/sentry/remote_subscriptions/migrations/__init__.py b/src/sentry/remote_subscriptions/migrations/__init__.py deleted file mode 100644 index e69de29bb2d1d6..00000000000000 diff --git a/src/sentry/uptime/migrations/0001_uptime_subscriptions.py b/src/sentry/uptime/migrations/0001_uptime_subscriptions.py index ddd6cb1ae7fdbd..5431ab2616f6e2 100644 --- a/src/sentry/uptime/migrations/0001_uptime_subscriptions.py +++ b/src/sentry/uptime/migrations/0001_uptime_subscriptions.py @@ -27,7 +27,6 @@ class Migration(CheckedMigration): initial = True dependencies = [ - ("remote_subscriptions", "0001_remote_subscription"), ("sentry", "0731_add_insight_project_flags"), ] @@ -41,14 +40,6 @@ class Migration(CheckedMigration): primary_key=True, serialize=False ), ), - ( - "remote_subscription", - sentry.db.models.fields.foreignkey.FlexibleForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to="remote_subscriptions.remotesubscription", - unique=True, - ), - ), ("url", models.CharField(max_length=255)), ("interval_seconds", models.IntegerField()), ("timeout_ms", models.IntegerField()), diff --git a/src/sentry/uptime/migrations/0002_remove_separate_remote_subscription.py b/src/sentry/uptime/migrations/0002_remove_separate_remote_subscription.py index 7135d12fd7d425..919f93a098109c 100644 --- a/src/sentry/uptime/migrations/0002_remove_separate_remote_subscription.py +++ b/src/sentry/uptime/migrations/0002_remove_separate_remote_subscription.py @@ -1,9 +1,7 @@ # Generated by Django 5.0.6 on 2024-06-21 17:10 -import django.db.models.deletion from django.db import migrations, models -import sentry.db.models.fields.foreignkey from sentry.new_migrations.migrations import CheckedMigration from sentry.new_migrations.monkey.special import SafeRunSQL @@ -25,16 +23,11 @@ class Migration(CheckedMigration): dependencies = [ ("uptime", "0001_uptime_subscriptions"), - ("remote_subscriptions", "0001_remote_subscription"), ] operations = [ migrations.SeparateDatabaseAndState( state_operations=[ - migrations.RemoveField( - model_name="uptimesubscription", - name="remote_subscription", - ), migrations.AddField( model_name="uptimesubscription", name="type", @@ -48,16 +41,6 @@ class Migration(CheckedMigration): ), ], database_operations=[ - migrations.AlterField( - model_name="uptimesubscription", - name="remote_subscription", - field=sentry.db.models.fields.foreignkey.FlexibleForeignKey( - null=True, - on_delete=django.db.models.deletion.CASCADE, - to="remote_subscriptions.remotesubscription", - unique=True, - ), - ), SafeRunSQL( """ ALTER TABLE "uptime_uptimesubscription" ADD COLUMN "type" text NOT NULL; diff --git a/src/sentry/uptime/migrations/0003_drop_remote_subscription.py b/src/sentry/uptime/migrations/0003_drop_remote_subscription.py index b8f4b473b8a662..71644b679789ae 100644 --- a/src/sentry/uptime/migrations/0003_drop_remote_subscription.py +++ b/src/sentry/uptime/migrations/0003_drop_remote_subscription.py @@ -1,6 +1,5 @@ # Generated by Django 5.0.6 on 2024-06-21 22:03 from sentry.new_migrations.migrations import CheckedMigration -from sentry.new_migrations.monkey.special import SafeRunSQL class Migration(CheckedMigration): @@ -22,14 +21,4 @@ class Migration(CheckedMigration): ("uptime", "0002_remove_separate_remote_subscription"), ] - operations = [ - SafeRunSQL( - """ - ALTER TABLE "uptime_uptimesubscription" DROP COLUMN "remote_subscription_id"; - """, - reverse_sql=""" - ALTER TABLE "uptime_uptimesubscription" ADD COLUMN "remote_subscription_id" bigint NULL; - """, - hints={"tables": ["uptime_uptimesubscription"]}, - ) - ] + operations = []