: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(growth): add OrganizationEnrichment model (#69425)
Matt Brooker38a913edbeb9
diff --git a/.github/scripts/check-idor-model-coverage.py b/.github/scripts/check-idor-model-coverage.pyindex f3c3d503beed..9ceb39d6c4c0 100644--- a/.github/scripts/check-idor-model-coverage.py+++ b/.github/scripts/check-idor-model-coverage.py@@ -158,6 +158,9 @@ def get_scoped_models() -> tuple[dict[str, set[str]], set[str], set[str], set[st"RunSnapshot","TicketAssignment",# --- Internal config / OneToOne settings ---+ # OneToOne extension of Organization, read via the org relation+ # (enrichment_record), never looked up by user-supplied ID.+ "OrganizationEnrichment",# Model kept to avoid a deletion migration but has no API endpoint"ErrorTrackingAutoCaptureControls","DuckLakeBackfill",diff --git a/products/growth/backend/migrations/0002_organizationenrichment.py b/products/growth/backend/migrations/0002_organizationenrichment.pynew file mode 100644index 000000000000..4a60692a3b33--- /dev/null+++ b/products/growth/backend/migrations/0002_organizationenrichment.py@@ -0,0 +1,45 @@+# Generated by Django 5.2.14 on 2026-07-08 19:05++import django.db.models.deletion+from django.db import migrations, models++import posthog.models.utils+++class Migration(migrations.Migration):+ dependencies = [+ ("growth", "0001_initial_migration"),+ ("posthog", "1247_oauthaccesstoken_token_idx"),+ ]++ operations = [+ migrations.CreateModel(+ name="OrganizationEnrichment",+ fields=[+ (+ "id",+ models.UUIDField(+ default=posthog.models.utils.uuid7,+ editable=False,+ primary_key=True,+ serialize=False,+ ),+ ),+ ("data", models.JSONField(default=dict)),+ ("created_at", models.DateTimeField(auto_now_add=True)),+ ("updated_at", models.DateTimeField(auto_now=True)),+ (+ "organization",+ models.OneToOneField(+ db_constraint=False,+ on_delete=django.db.models.deletion.CASCADE,+ related_name="enrichment_record",+ to="posthog.organization",+ ),+ ),+ ],+ options={+ "abstract": False,+ },+ ),+ ]diff --git a/products/growth/backend/migrations/max_migration.txt b/products/growth/backend/migrations/max_migration.txtindex b0345048105e..111c4dc7c854 100644--- a/products/growth/backend/migrations/max_migration.txt+++ b/products/growth/backend/migrations/max_migration.txt@@ -1 +1 @@-0001_initial_migration+0002_organizationenrichmentdiff --git a/products/growth/backend/models.py b/products/growth/backend/models.pyindex e2397d528f7e..2e191e6a636d 100644--- a/products/growth/backend/models.py+++ b/products/growth/backend/models.py@@ -101,3 +101,15 @@ class ProductPushCampaign(UUIDModel, UpdatedMetaFields):def __str__(self) -> str:return f"{self.organization_id} - {self.product_key} ({self.status})"+++class OrganizationEnrichment(UUIDModel):+ # db_constraint=False keeps CreateModel off posthog_organization's lock path (hot table)+ organization = models.OneToOneField(+ "posthog.Organization", on_delete=models.CASCADE, db_constraint=False, related_name="enrichment_record"+ )+ # Namespaced deterministic enrichment signals, e.g. company_type_deterministic+ data = models.JSONField(default=dict)++ created_at = models.DateTimeField(auto_now_add=True)+ updated_at = models.DateTimeField(auto_now=True)