Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(replay-vision): untrack the media backfill columns and drop their index (#105552)

Tue Haulund3244d7039004
diff --git a/products/replay_vision/backend/migrations/0099_untrack_media_render_attempts.py b/products/replay_vision/backend/migrations/0099_untrack_media_render_attempts.py
new file mode 100644
index 000000000000..dcb963fbdf7c
--- /dev/null
+++ b/products/replay_vision/backend/migrations/0099_untrack_media_render_attempts.py
@@ -0,0 +1,21 @@
+from django.db import migrations
+
+from posthog.migration_helpers import SafeRemoveIndexConcurrently, untrack_field
+
+
+class Migration(migrations.Migration):
+ # CONCURRENTLY cannot run inside a transaction; replay_observation is large in production.
+ atomic = False
+
+ dependencies = [
+ ("replay_vision", "0098_replayobservation_rlo_succeeded_created_idx"),
+ ]
+
+ operations = [
+ # The columns stay: media_render_attempts is NOT NULL, and its database default of 0 fills it once Django stops writing it.
+ untrack_field("replayobservation", "media_render_attempts", "media_render_attempted_at"),
+ SafeRemoveIndexConcurrently(
+ model_name="replayobservation",
+ name="rlo_succeeded_created_idx",
+ ),
+ ]
diff --git a/products/replay_vision/backend/migrations/max_migration.txt b/products/replay_vision/backend/migrations/max_migration.txt
index 8e10ed324e0d..b62ecc0d002a 100644
--- a/products/replay_vision/backend/migrations/max_migration.txt
+++ b/products/replay_vision/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0098_replayobservation_rlo_succeeded_created_idx
+0099_untrack_media_render_attempts
diff --git a/products/replay_vision/backend/models/replay_observation.py b/products/replay_vision/backend/models/replay_observation.py
index 42dfc1ee8143..b1b20944124f 100644
--- a/products/replay_vision/backend/models/replay_observation.py
+++ b/products/replay_vision/backend/models/replay_observation.py
@@ -118,10 +118,6 @@ class ReplayObservation(UUIDModel):
completed_at = models.DateTimeField(null=True, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
- # DEPRECATED: These fields supported the media-backfill sweep. No code reads or writes them.
- media_render_attempts = models.PositiveSmallIntegerField(default=0, db_default=0)
- media_render_attempted_at = models.DateTimeField(null=True, blank=True)
-
class Meta:
constraints = [
# Succeeded rows are sticky; admin deletes to re-trigger. A backfill may retake a failed row.
@@ -148,12 +144,6 @@ class ReplayObservation(UUIDModel):
),
# Serves the per-scanner list ordering and the prev/next-neighbor lookups (both order by created_at).
models.Index(fields=["scanner", "created_at"], name="rlo_scanner_created_idx"),
- # DEPRECATED: This index supported the media-backfill cross-team walk. No query needs it.
- models.Index(
- fields=["-created_at"],
- name="rlo_succeeded_created_idx",
- condition=models.Q(status="succeeded"),
- ),
models.Index(
fields=["workflow_id"],
name="rlo_workflow_id_idx",