From e9e390861a4c26cc6e6c82ad49e77138f3cfb8c4 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 5 May 2026 16:05:46 -0700 Subject: [PATCH 1/2] ref(dashboards): Drop DashboardLastVisited table MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drop the sentry_dashboardlastvisited table from PostgreSQL via SafeDeleteModel(DELETE). Do not merge until #(prev PR) has been deployed and verified — the prior PR removes Django's knowledge of the model and drops FK constraints, but leaves the table in place for rolling deploy safety. PR Stack: 1. Remove model + MOVE_TO_PENDING migration 2. **this PR** — DELETE migration to drop the table Co-Authored-By: Claude Opus 4.7 (1M context) --- migrations_lockfile.txt | 2 +- .../1084_delete_dashboardlastvisited.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/sentry/migrations/1084_delete_dashboardlastvisited.py diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt index 3afe8613496c..039e84a9a49e 100644 --- a/migrations_lockfile.txt +++ b/migrations_lockfile.txt @@ -31,7 +31,7 @@ replays: 0007_organizationmember_replay_access seer: 0010_drop_legacy_columns -sentry: 1083_remove_dashboardlastvisited +sentry: 1084_delete_dashboardlastvisited social_auth: 0003_social_auth_json_field diff --git a/src/sentry/migrations/1084_delete_dashboardlastvisited.py b/src/sentry/migrations/1084_delete_dashboardlastvisited.py new file mode 100644 index 000000000000..df2d750805cc --- /dev/null +++ b/src/sentry/migrations/1084_delete_dashboardlastvisited.py @@ -0,0 +1,18 @@ +from sentry.new_migrations.migrations import CheckedMigration +from sentry.new_migrations.monkey.models import SafeDeleteModel +from sentry.new_migrations.monkey.state import DeletionAction + + +class Migration(CheckedMigration): + is_post_deployment = False + + dependencies = [ + ("sentry", "1083_remove_dashboardlastvisited"), + ] + + operations = [ + SafeDeleteModel( + name="DashboardLastVisited", + deletion_action=DeletionAction.DELETE, + ), + ] From 4ff58bf76f12aa5560318cdba7064bd117123b3c Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 5 May 2026 16:11:04 -0700 Subject: [PATCH 2/2] ref(db): Add sentry_dashboardlastvisited to historical_silo_assignments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SafeDeleteModel(DELETE) needs the table → silo mapping to know which DB to drop the table from. Once the model class is removed (prior PR), the router can no longer resolve this on its own, so we record it here alongside dashboardtombstone and the rest. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/sentry/db/router.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sentry/db/router.py b/src/sentry/db/router.py index 496fd7be1eb8..692a37ed12ff 100644 --- a/src/sentry/db/router.py +++ b/src/sentry/db/router.py @@ -78,6 +78,7 @@ class SiloRouter: "sentry_code_review_event": SiloMode.CELL, "sentry_customdynamicsamplingrule": SiloMode.CELL, "sentry_customdynamicsamplingruleproject": SiloMode.CELL, + "sentry_dashboardlastvisited": SiloMode.CELL, "sentry_dashboardtombstone": SiloMode.CELL, "sentry_dashboardwidgetsnapshot": SiloMode.CELL, "sentry_datasecrecywaiver": SiloMode.CELL,