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.

feat(batch-exports): add last updated by user fields (#105192)

Tomás Farías Santanadadf6e47f99b
diff --git a/products/batch_exports/backend/migrations/0008_add_last_updated_by.py b/products/batch_exports/backend/migrations/0008_add_last_updated_by.py
new file mode 100644
index 000000000000..3dd06b099577
--- /dev/null
+++ b/products/batch_exports/backend/migrations/0008_add_last_updated_by.py
@@ -0,0 +1,43 @@
+# Generated by Django 5.2.17 on 2026-09-23 10:45
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("batch_exports", "0007_alter_batchexportrun_data_interval_end"),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="batchexport",
+ name="last_modified_by",
+ field=models.ForeignKey(
+ blank=True,
+ db_constraint=False,
+ db_index=False,
+ help_text="The user who last saved this batch export's configuration.",
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ migrations.AddField(
+ model_name="batchexportondemand",
+ name="last_modified_by",
+ field=models.ForeignKey(
+ blank=True,
+ db_constraint=False,
+ db_index=False,
+ help_text="The user who last saved this batch export's configuration.",
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ]
diff --git a/products/batch_exports/backend/migrations/max_migration.txt b/products/batch_exports/backend/migrations/max_migration.txt
index 48ad53c773c9..eb18429f14bb 100644
--- a/products/batch_exports/backend/migrations/max_migration.txt
+++ b/products/batch_exports/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0007_alter_batchexportrun_data_interval_end
+0008_add_last_updated_by
diff --git a/products/batch_exports/backend/models/batch_export.py b/products/batch_exports/backend/models/batch_export.py
index 8dca15a85260..49ed7d9bc12b 100644
--- a/products/batch_exports/backend/models/batch_export.py
+++ b/products/batch_exports/backend/models/batch_export.py
@@ -368,6 +368,16 @@ class BatchExport(ModelActivityMixin, UUIDTModel):
auto_now=True,
help_text="The timestamp at which this BatchExport was last updated.",
)
+ last_modified_by = models.ForeignKey(
+ "posthog.User",
+ on_delete=models.SET_NULL,
+ null=True,
+ blank=True,
+ db_constraint=False,
+ db_index=False,
+ related_name="+",
+ help_text="The user who last saved this batch export's configuration.",
+ )
last_paused_at = models.DateTimeField(
null=True,
default=None,
@@ -732,6 +742,16 @@ class BatchExportOnDemand(TeamScopedRootMixin, ModelActivityMixin, UUIDTModel):
auto_now=True,
help_text="The timestamp at which this was last updated.",
)
+ last_modified_by = models.ForeignKey(
+ "posthog.User",
+ on_delete=models.SET_NULL,
+ null=True,
+ blank=True,
+ db_constraint=False,
+ db_index=False,
+ related_name="+",
+ help_text="The user who last saved this batch export's configuration.",
+ )
model = models.CharField(
max_length=64,
null=True,