From ae8558919841e64e4361c7254d2125ca801e86cb Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 15:10:11 +0000 Subject: [PATCH 1/2] feat(sourcemaps): Add has_debug_ids flag to ProjectArtifactBundle Adds a column that says whether the linked bundle has any DebugIdArtifactBundle rows, so checking whether a project uploaded any file with a debug ID can read only the project's links instead of the organization's debug-ID rows. The column is on the link and not on the bundle, so that a partial index on project_id can answer the check with one lookup. Nothing writes or reads it yet. Co-Authored-By: Jan Michael Auer <1433023+jan-auer@users.noreply.github.com> --- migrations_lockfile.txt | 2 +- ...add_projectartifactbundle_has_debug_ids.py | 33 +++++++++++++++++++ src/sentry/models/artifactbundle.py | 3 ++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/sentry/migrations/1259_add_projectartifactbundle_has_debug_ids.py diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt index ef4bce116ddc..2d2931d45f66 100644 --- a/migrations_lockfile.txt +++ b/migrations_lockfile.txt @@ -41,7 +41,7 @@ seer: 0046_add_workflow_config_backing_workflow seer_workflow_outputs: 0001_initial -sentry: 1258_artifactbundleindex_drop_organization_id_index +sentry: 1259_add_projectartifactbundle_has_debug_ids service_accounts: 0007_add_service_account_token_replica diff --git a/src/sentry/migrations/1259_add_projectartifactbundle_has_debug_ids.py b/src/sentry/migrations/1259_add_projectartifactbundle_has_debug_ids.py new file mode 100644 index 000000000000..69668ae4a101 --- /dev/null +++ b/src/sentry/migrations/1259_add_projectartifactbundle_has_debug_ids.py @@ -0,0 +1,33 @@ +# Generated by Django 5.2.17 on 2026-11-10 15:09 + +from django.db import migrations, models + +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", "1258_artifactbundleindex_drop_organization_id_index"), + ] + + operations = [ + migrations.AddField( + model_name="projectartifactbundle", + name="has_debug_ids", + field=models.BooleanField(db_default=False), + ), + ] diff --git a/src/sentry/models/artifactbundle.py b/src/sentry/models/artifactbundle.py index 3f03695d78d0..2fd292b7f6b1 100644 --- a/src/sentry/models/artifactbundle.py +++ b/src/sentry/models/artifactbundle.py @@ -209,6 +209,9 @@ class ProjectArtifactBundle(Model): organization_id = BoundedBigIntegerField(db_index=True) project_id = BoundedBigIntegerField() artifact_bundle = FlexibleForeignKey("sentry.ArtifactBundle") + # Whether the bundle has any `DebugIdArtifactBundle` rows. It is on the link and not on the bundle, so that + # checking if a project uploaded any file with a debug ID reads only the project's flagged links. + has_debug_ids = models.BooleanField(db_default=False) date_added = models.DateTimeField(default=timezone.now) class Meta: From 7d74144f818d53aa083ab30f15fb34b3d21e1c3e Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 13 Nov 2026 09:14:10 +0000 Subject: [PATCH 2/2] ref(sourcemaps): Remove has_debug_ids field comment --- src/sentry/models/artifactbundle.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sentry/models/artifactbundle.py b/src/sentry/models/artifactbundle.py index 2fd292b7f6b1..df3a5495f2ab 100644 --- a/src/sentry/models/artifactbundle.py +++ b/src/sentry/models/artifactbundle.py @@ -209,8 +209,6 @@ class ProjectArtifactBundle(Model): organization_id = BoundedBigIntegerField(db_index=True) project_id = BoundedBigIntegerField() artifact_bundle = FlexibleForeignKey("sentry.ArtifactBundle") - # Whether the bundle has any `DebugIdArtifactBundle` rows. It is on the link and not on the bundle, so that - # checking if a project uploaded any file with a debug ID reads only the project's flagged links. has_debug_ids = models.BooleanField(db_default=False) date_added = models.DateTimeField(default=timezone.now)