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(managed-migrations): make batch import secrets column nullable (#73374)

Nick Best4af3516621ca
diff --git a/products/managed_migrations/backend/migrations/0002_alter_batchimport_secrets_nullable.py b/products/managed_migrations/backend/migrations/0002_alter_batchimport_secrets_nullable.py
new file mode 100644
index 000000000000..92731f822c6e
--- /dev/null
+++ b/products/managed_migrations/backend/migrations/0002_alter_batchimport_secrets_nullable.py
@@ -0,0 +1,19 @@
+# Generated by Django 5.2.14 on 2026-07-07 23:46
+
+from django.db import migrations
+
+import posthog.helpers.encrypted_fields
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("managed_migrations", "0001_migrate_managed_migrations_models"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="batchimport",
+ name="secrets",
+ field=posthog.helpers.encrypted_fields.EncryptedJSONStringField(blank=True, null=True),
+ ),
+ ]
diff --git a/products/managed_migrations/backend/migrations/max_migration.txt b/products/managed_migrations/backend/migrations/max_migration.txt
index 9a52df6b05e6..1c8a2e00b2a7 100644
--- a/products/managed_migrations/backend/migrations/max_migration.txt
+++ b/products/managed_migrations/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0001_migrate_managed_migrations_models
+0002_alter_batchimport_secrets_nullable
diff --git a/products/managed_migrations/backend/models/batch_imports.py b/products/managed_migrations/backend/models/batch_imports.py
index f54d75b89588..d96853d7c7f6 100644
--- a/products/managed_migrations/backend/models/batch_imports.py
+++ b/products/managed_migrations/backend/models/batch_imports.py
@@ -46,7 +46,7 @@ class BatchImport(ModelActivityMixin, UUIDTModel):
display_status_message = models.TextField(null=True, blank=True)
state = models.JSONField(null=True, blank=True)
import_config = models.JSONField()
- secrets = EncryptedJSONStringField()
+ secrets = EncryptedJSONStringField(null=True, blank=True)
# Exponential backoff state (used by rust worker). Mirrors columns used by the worker.
backoff_attempt = models.IntegerField(default=0)
backoff_until = models.DateTimeField(null=True, blank=True)