mig: drop toolsets.oauth_proxy_server_id

Merged
DA
5d ago
+15-21

AIM-671

Merge only after PR #8019 is deployed to prod.

Summary

  • Drops toolsets.oauth_proxy_server_id, its foreign key toolsets_oauth_proxy_server_id_fkey (removed with the column), and the toolsets_oauth_exclusivity CHECK. The CHECK only kept the proxy link and the external OAuth link exclusive, so it means nothing without the column.
  • Removes the column's statement from server/database/sqlc_retired_columns.sql, which leaves the file empty, so the file and its four sqlc.yaml entries go too. Regenerating sqlc changes only database/models.go. The per-package toolsets code is already column-free.
  • Keeps oauth_proxy_servers, oauth_proxy_providers and oauth_proxy_client_info and their rows. The stored upstream credentials stay for now.

Motivation

#8019 stopped every read of the column. This is the contract step.

Ordering requirement

sqlc expands SELECT * and RETURNING * into explicit column lists at generation time. Every server and worker image built before #8019 names oauth_proxy_server_id in about 23 toolsets queries, and those queries are on the MCP serving path. Once this migration runs, those images fail every toolset read with column "oauth_proxy_server_id" does not exist (42703). Merge this only after #8019 runs on every prod pod and no pre-#8019 image can be a rollback target.

The links on the toolsets that still carry one are discarded on purpose. Every such toolset in a live project is gated by a user session issuer, so nothing serves through the link. -- atlas:nolint DS103 acknowledges the destructive drop, as earlier drops did. Dropping a nullable column and a CHECK is metadata-only and does not rewrite or scan toolsets.

Rollback and follow-up

  • After this runs, the oldest image that can serve is #8019's release. The discarded links cannot be restored by re-adding the column.
  • The ALTER TABLE needs a brief ACCESS EXCLUSIVE lock on toolsets, as earlier column drops did. It queues behind any long transaction holding a lock on the table.
  • After this ships, testenv.LinkRetiredOAuthProxy has nothing to link, so its five callers no longer exercise a proxy link. A small follow-up code PR deletes the helper and those tests. They stay out of this PR because mig: PRs carry no test changes.

šŸ¤– Generated with Claude Code


Summary by cubic

Drops toolsets.oauth_proxy_server_id, its foreign key, and the toolsets_oauth_exclusivity CHECK that kept the proxy link exclusive with the external OAuth link, completing the retirement contract from #8019. Removes the now-empty sqlc_retired_columns.sql file and its four sqlc.yaml entries; regenerating sqlc only changes database/models.go. The oauth_proxy_servers, oauth_proxy_providers, and oauth_proxy_client_info tables and rows stay.

Merge ordering

Merge only after #8019 runs on every prod pod. Any pre-#8019 image still names oauth_proxy_server_id in ~23 toolsets queries on the MCP serving path, and those fail with a 42703 missing-column error once this migration runs.

Migration notes

Dropping a nullable column and a CHECK is metadata-only and doesn't rewrite or scan toolsets, but needs a brief ACCESS EXCLUSIVE lock that queues behind long transactions. The dropped links can't be restored by re-adding the column; the oldest image that can serve afterward is #8019's release. A follow-up code PR will delete the testenv.LinkRetiredOAuthProxy helper and its five callers.