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.

fix(migrations): order the scim backfill before the idp config rename (#92802)

Georges-Antoine Assi8a63f2f7f9de
diff --git a/ee/migrations/0058_backfill_scim_provisioned_user_config.py b/ee/migrations/0058_backfill_scim_provisioned_user_config.py
index b851b04d0c4b..634a3e3f6cb7 100644
--- a/ee/migrations/0058_backfill_scim_provisioned_user_config.py
+++ b/ee/migrations/0058_backfill_scim_provisioned_user_config.py
@@ -84,6 +84,11 @@ def backfill_scim_provisioned_user_config(apps: Any, schema_editor: Any) -> None
class Migration(migrations.Migration):
dependencies = [("ee", "0057_scim_records_identity_provider_config_indexes")]
+ # This backfill reads OrganizationDomain.identity_provider_config, which posthog.1316 renames in
+ # migration state. Without this edge the planner is free to apply 1316 first, and the backfill
+ # then fails on a fresh database with an unsupported-lookup FieldError.
+ run_before = [("posthog", "1316_deprecate_organization_domain_idp_config")]
+
operations = [
migrations.RunPython(
backfill_scim_provisioned_user_config,