: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
chore(oauth): drop the cimd_metadata_url column (#86764)
Rafael Audibert6c4717b6ccc5
diff --git a/posthog/admin/test_oauth_admin.py b/posthog/admin/test_oauth_admin.pyindex 1ea7493eedd2..d53a416b0140 100644--- a/posthog/admin/test_oauth_admin.py+++ b/posthog/admin/test_oauth_admin.py@@ -227,8 +227,8 @@ class TestOAuthApplicationAdmin(BaseTest):])def test_cimd_identity_fields_are_not_editable(self, _name, change):- # An operator who could turn on is_cimd_client, or set a metadata URL, would hand the- # next metadata refresh an app that no partner registered.+ # An operator who could turn on is_cimd_client would hand the next metadata refresh+ # an app that no partner registered.app = OAuthApplication(is_cimd_client=False) if change else Nonerequest = RequestFactory().get("/")# A user without change permission gets an empty change form, which would pass this@@ -237,7 +237,5 @@ class TestOAuthApplicationAdmin(BaseTest):request.user = self.userform_class = self.admin.get_form(request, app, change=change)assert "name" in form_class.base_fields- editable = [- name for name in ("is_cimd_client", "is_dcr_client", "cimd_metadata_url") if name in form_class.base_fields- ]+ editable = [name for name in ("is_cimd_client", "is_dcr_client") if name in form_class.base_fields]assert editable == []diff --git a/posthog/migrations/1329_drop_cimd_metadata_url.py b/posthog/migrations/1329_drop_cimd_metadata_url.pynew file mode 100644index 000000000000..ba20fcbc5a73--- /dev/null+++ b/posthog/migrations/1329_drop_cimd_metadata_url.py@@ -0,0 +1,29 @@+from django.db import migrations+++class Migration(migrations.Migration):+ """Drop the cimd_metadata_url column.++ 1327 removed the field from Django state, so this is the database half of that drop and+ carries no state operation. Land it only once 1327 has been deployed for a full deploy+ cycle: before that, a rollback restores code that still selects the column.++ Reverse recreates the column and its indexes so rolling this one back on its own leaves a+ schema Django agrees with. The values are gone for good, which is safe because client_id+ holds the same URL for every row that had one.+ """++ dependencies = [("posthog", "1328_remove_userproductlist_reason_state")]++ operations = [+ migrations.RunSQL(+ sql='ALTER TABLE "posthog_oauthapplication" DROP COLUMN IF EXISTS "cimd_metadata_url"; -- drop-column-ignore',+ reverse_sql="""+ ALTER TABLE "posthog_oauthapplication" ADD COLUMN IF NOT EXISTS "cimd_metadata_url" varchar(2048) NULL;+ CREATE UNIQUE INDEX IF NOT EXISTS "posthog_oauthapplication_cimd_metadata_url_key"+ ON "posthog_oauthapplication" ("cimd_metadata_url");+ CREATE INDEX IF NOT EXISTS "posthog_oauthapplication_cimd_metadata_url_df24bc90_like"+ ON "posthog_oauthapplication" ("cimd_metadata_url" varchar_pattern_ops);+ """,+ ),+ ]diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txtindex e58cbed2d9fa..10673305c79d 100644--- a/posthog/migrations/max_migration.txt+++ b/posthog/migrations/max_migration.txt@@ -1 +1 @@-1328_remove_userproductlist_reason_state+1329_drop_cimd_metadata_url